[clang] [Clang] Consider reachability for file-scope warnings on initializers (PR #163885)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 11:04:45 PDT 2025


================
@@ -2935,45 +2991,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(
   }
 
   // Emit delayed diagnostics.
-  if (!fscope->PossiblyUnreachableDiags.empty()) {
-    bool analyzed = false;
-
-    // Register the expressions with the CFGBuilder.
-    for (const auto &D : fscope->PossiblyUnreachableDiags) {
-      for (const Stmt *S : D.Stmts)
-        AC.registerForcedBlockExpression(S);
-    }
-
-    if (AC.getCFG()) {
-      analyzed = true;
-      for (const auto &D : fscope->PossiblyUnreachableDiags) {
-        bool AllReachable = true;
-        for (const Stmt *S : D.Stmts) {
-          const CFGBlock *block = AC.getBlockForRegisteredExpression(S);
-          CFGReverseBlockReachabilityAnalysis *cra =
-              AC.getCFGReachablityAnalysis();
-          // FIXME: We should be able to assert that block is non-null, but
----------------
JustinStitt wrote:

right, added the FIXME back and rebased to resolve conflicts. thanks

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


More information about the cfe-commits mailing list