github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff fe20a759fcd20e1755ea1b34c5e6447a787925dc 26f7904095ddd54ab54a94b3ae84db61d2135833 -- clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/test/Analysis/Checkers/WebKit/call-args.cpp clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp index b2169bf023..528ca77c49 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp @@ -233,10 +233,10 @@ bool isSingleton(const FunctionDecl *F) { const auto &Name = safeGetName(F); std::string SingletonStr = "singleton"; auto index = Name.find(SingletonStr); - return index != std::string::npos && index == Name.size() - SingletonStr.size(); + return index != std::string::npos && + index == Name.size() - SingletonStr.size(); } - // We only care about statements so let's use the simple // (non-recursive) visitor. class TrivialFunctionAnalysisVisitor @@ -255,7 +255,7 @@ class TrivialFunctionAnalysisVisitor public: using CacheTy = TrivialFunctionAnalysis::CacheTy; - TrivialFunctionAnalysisVisitor(CacheTy &Cache): Cache(Cache) {} + TrivialFunctionAnalysisVisitor(CacheTy &Cache) : Cache(Cache) {} bool VisitStmt(const Stmt *S) { // All statements are non-trivial unless overriden later. @@ -263,9 +263,7 @@ public: return false; } - bool VisitDeclStmt(const DeclStmt *DS) { - return VisitChildren(DS); - } + bool VisitDeclStmt(const DeclStmt *DS) { return VisitChildren(DS); } bool VisitCompoundStmt(const CompoundStmt *CS) { // A compound statement is allowed as long each individual sub-statement @@ -278,25 +276,15 @@ public: return Visit(RS->getRetValue()); } - bool VisitDoStmt(const DoStmt *DS) { - return VisitChildren(DS); - } + bool VisitDoStmt(const DoStmt *DS) { return VisitChildren(DS); } - bool VisitIfStmt(const IfStmt *IS) { - return VisitChildren(IS); - } + bool VisitIfStmt(const IfStmt *IS) { return VisitChildren(IS); } - bool VisitSwitchStmt(const SwitchStmt *SS) { - return VisitChildren(SS); - } - - bool VisitCaseStmt(const CaseStmt* CS) { - return VisitChildren(CS); - } + bool VisitSwitchStmt(const SwitchStmt *SS) { return VisitChildren(SS); } - bool VisitDefaultStmt(const DefaultStmt* DS) { - return VisitChildren(DS); - } + bool VisitCaseStmt(const CaseStmt *CS) { return VisitChildren(CS); } + + bool VisitDefaultStmt(const DefaultStmt *DS) { return VisitChildren(DS); } bool VisitUnaryOperator(const UnaryOperator *UO) { // Operator '*' and '!' are allowed as long as the operand is trivial. @@ -316,7 +304,7 @@ public: // Ternary operators are trivial if their conditions & values are trivial. return VisitChildren(CO); } - + bool VisitDeclRefExpr(const DeclRefExpr *DRE) { if (auto *decl = DRE->getDecl()) { if (isa<ParmVarDecl>(decl)) @@ -336,7 +324,7 @@ public: for (const Expr *Arg : CE->arguments()) { if (Arg && !Visit(Arg)) - return false; + return false; } auto *Callee = CE->getDirectCallee(); @@ -344,8 +332,8 @@ public: return false; const auto &Name = safeGetName(Callee); - if (Name == "WTFCrashWithInfo" || Name == "WTFBreakpointTrap" - || Name == "compilerFenceForCrash" || Name == "__builtin_unreachable") + if (Name == "WTFCrashWithInfo" || Name == "WTFBreakpointTrap" || + Name == "compilerFenceForCrash" || Name == "__builtin_unreachable") return true; return TrivialFunctionAnalysis::isTrivialImpl(Callee, Cache); @@ -354,7 +342,7 @@ public: bool VisitCXXMemberCallExpr(const CXXMemberCallExpr *MCE) { for (const Expr *Arg : MCE->arguments()) { if (Arg && !Visit(Arg)) - return false; + return false; } bool TrivialThis = Visit(MCE->getImplicitObjectArgument()); @@ -366,7 +354,6 @@ public: if (IsGetterOfRefCounted && *IsGetterOfRefCounted) return true; - // Recursively descend into the callee to confirm that it's trivial as well. return TrivialFunctionAnalysis::isTrivialImpl(MCE->getDirectCallee(), Cache); @@ -378,27 +365,20 @@ public: return false; // Recursively descend into the callee to confirm that it's trivial. - return TrivialFunctionAnalysis::isTrivialImpl(CE->getConstructor(), - Cache); + return TrivialFunctionAnalysis::isTrivialImpl(CE->getConstructor(), Cache); } - bool VisitImplicitCastExpr(const ImplicitCastExpr *ICE) - { + bool VisitImplicitCastExpr(const ImplicitCastExpr *ICE) { return Visit(ICE->getSubExpr()); } - bool VisitExplicitCastExpr(const ExplicitCastExpr *ECE) - { + bool VisitExplicitCastExpr(const ExplicitCastExpr *ECE) { return Visit(ECE->getSubExpr()); } - bool VisitParenExpr(const ParenExpr *PE) - { - return Visit(PE->getSubExpr()); - } + bool VisitParenExpr(const ParenExpr *PE) { return Visit(PE->getSubExpr()); } - bool VisitInitListExpr(const InitListExpr *ILE) - { + bool VisitInitListExpr(const InitListExpr *ILE) { for (const Expr *Child : ILE->inits()) { if (Child && !Visit(Child)) return false; @@ -417,27 +397,17 @@ public: } // Constant literal expressions are always trivial - bool VisitIntegerLiteral(const IntegerLiteral *E) { - return true; - } + bool VisitIntegerLiteral(const IntegerLiteral *E) { return true; } - bool VisitFloatingLiteral(const FloatingLiteral *E) { - return true; - } + bool VisitFloatingLiteral(const FloatingLiteral *E) { return true; } - bool VisitFixedPointLiteral(const FixedPointLiteral *E) { - return true; - } + bool VisitFixedPointLiteral(const FixedPointLiteral *E) { return true; } - bool VisitCharacterLiteral(const CharacterLiteral *E) { - return true; - } + bool VisitCharacterLiteral(const CharacterLiteral *E) { return true; } - bool VisitStringLiteral(const StringLiteral *E) { - return true; - } + bool VisitStringLiteral(const StringLiteral *E) { return true; } - bool VisitConstantExpr(const ConstantExpr* CE) { + bool VisitConstantExpr(const ConstantExpr *CE) { // Constant expressions are trivial. return true; } diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h index a5ea3900ce..e07cd31395 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h @@ -70,9 +70,7 @@ bool isSingleton(const FunctionDecl *F); class TrivialFunctionAnalysis { public: /// \returns true if \p D is a "trivial" function. - bool isTrivial(const Decl *D) const { - return isTrivialImpl(D, TheCache); - } + bool isTrivial(const Decl *D) const { return isTrivialImpl(D, TheCache); } private: friend class TrivialFunctionAnalysisVisitor; `````````` </details> https://github.com/llvm/llvm-project/pull/81808 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits