[clang] Control analysis-based diagnostics with #pragma (PR #136323)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 6 02:28:38 PDT 2025


================
@@ -16597,7 +16597,8 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
   BD->setCaptures(Context, Captures, BSI->CXXThisCaptureIndex != 0);
 
   // Pop the block scope now but keep it alive to the end of this function.
-  AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
+  AnalysisBasedWarnings::Policy WP =
+      AnalysisWarnings.getPolicyInEffectAt(Body->getEndLoc());
----------------
steakhal wrote:

I think the statement `BD->setBody(cast<CompoundStmt>(Body));`  dominates all checks to `Body`, consequently, I don't think `Body` can be null. I'd say, the checks for `Body` are redundant.

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


More information about the cfe-commits mailing list