[clang] Reapply [Analyzer][CFG] Correctly handle rebuilt default arg and default init expression (PR #146281)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 29 09:53:18 PDT 2025


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 HEAD~1 HEAD --extensions h,cpp -- clang/include/clang/AST/ParentMap.h clang/lib/AST/ParentMap.cpp clang/lib/Analysis/CFG.cpp clang/lib/Analysis/ReachableCode.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/StaticAnalyzer/Core/ExprEngine.cpp clang/test/AST/ast-dump-recovery.cpp clang/test/Analysis/lifetime-extended-regions.cpp clang/test/SemaCXX/cxx2c-placeholder-vars.cpp clang/test/SemaCXX/warn-unreachable.cpp clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp
index a8f6df5f3..750cea165 100644
--- a/clang/lib/Analysis/ReachableCode.cpp
+++ b/clang/lib/Analysis/ReachableCode.cpp
@@ -405,10 +405,10 @@ namespace {
     DeferredLocsTy DeferredLocs;
 
   public:
-    DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP, AnalysisDeclContext &AC)
-    : Visited(reachable.size()),
-      Reachable(reachable),
-      PP(PP), C(AC.getASTContext()), AC(AC) {}
+    DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP,
+                 AnalysisDeclContext &AC)
+        : Visited(reachable.size()), Reachable(reachable), PP(PP),
+          C(AC.getASTContext()), AC(AC) {}
 
     void enqueue(const CFGBlock *block);
     unsigned scanBackwards(const CFGBlock *Start,
@@ -455,7 +455,8 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) {
   return isDeadRoot;
 }
 
-static bool isValidDeadStmt(ParentMap &PM, const Stmt *S, const clang::CFGBlock *Block) {
+static bool isValidDeadStmt(ParentMap &PM, const Stmt *S,
+                            const clang::CFGBlock *Block) {
   if (S->getBeginLoc().isInvalid())
     return false;
   if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(S))

``````````

</details>


https://github.com/llvm/llvm-project/pull/146281


More information about the cfe-commits mailing list