[clang] [Clang] [NFC] Refactor AST visitors in Sema and the static analyser to use DRAV (PR #115144)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 6 02:58:48 PST 2024
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 0e907c17214aa3b1a60b66867fea3cc0f0dcbaa0 2074e8a732fbe04365d82ec8fcbff5635228be2d --extensions h,cpp -- clang/include/clang/Analysis/CallGraph.h clang/include/clang/Analysis/FlowSensitive/ASTOps.h clang/lib/Analysis/CallGraph.cpp clang/lib/Analysis/CalledOnceCheck.cpp clang/lib/Analysis/FlowSensitive/ASTOps.cpp clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp clang/lib/Analysis/ReachableCode.cpp clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/SemaAvailability.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaDeclObjC.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaExprCXX.cpp clang/lib/Sema/SemaFunctionEffects.cpp clang/lib/Sema/SemaHLSL.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/SemaStmt.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Sema/SemaTemplateDeductionGuide.cpp clang/lib/Sema/SemaTemplateInstantiate.cpp clang/lib/Sema/SemaTemplateVariadic.cpp clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLocalVarsChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefMemberChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp clang/lib/StaticAnalyzer/Core/BugSuppression.cpp clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index abee6b1075..2c33814ace 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1152,8 +1152,8 @@ public:
break;
}
// Don't care about other unreachable statements.
- }
}
+ }
// If there are no unreachable statements, this may be a special
// case in CFG:
// case X: {
@@ -1163,7 +1163,7 @@ public:
// // <<<< This place is represented by a 'hanging' CFG block.
// case Y:
continue;
- }
+ }
const Stmt *LastStmt = getLastStmt(*P);
if (const AttributedStmt *AS = asFallThroughAttr(LastStmt)) {
@@ -1180,20 +1180,20 @@ public:
}
++UnannotatedCnt;
- }
- return !!UnannotatedCnt;
}
+ return !!UnannotatedCnt;
+ }
- bool VisitAttributedStmt(AttributedStmt *S) override {
- if (asFallThroughAttr(S))
- FallthroughStmts.insert(S);
- return true;
- }
+ bool VisitAttributedStmt(AttributedStmt *S) override {
+ if (asFallThroughAttr(S))
+ FallthroughStmts.insert(S);
+ return true;
+ }
- bool VisitSwitchStmt(SwitchStmt *S) override {
- FoundSwitchStatements = true;
- return true;
- }
+ bool VisitSwitchStmt(SwitchStmt *S) override {
+ FoundSwitchStatements = true;
+ return true;
+ }
// We don't want to traverse local type declarations. We analyze their
// methods separately.
``````````
</details>
https://github.com/llvm/llvm-project/pull/115144
More information about the cfe-commits
mailing list