[clang] [Clang] Consider reachability for file-scope warnings on initializers (PR #163885)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 19 00:36:20 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
----------------
zwuis wrote:
Can we `assert(block)`?
https://github.com/llvm/llvm-project/pull/163885
More information about the cfe-commits
mailing list