[clang] [analyzer] Fix false positive on `UnreachableCode` with CTU mode (PR #219225)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 28 02:34:17 PDT 2026


================
@@ -0,0 +1,21 @@
+// RUN: %clang_analyze_cc1 -std=c++20 \
+// RUN:   -analyzer-checker=core,alpha.deadcode.UnreachableCode \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config max-nodes=10 \
+// RUN:   -verify=ctu-on %s
+// ctu-on-no-diagnostics
----------------
steakhal wrote:

Given that you enable CTU, shouldn't the invocation lists or have some AST dumps? I fear that CTU was enabled here, but was ineffective.

Could you demonstrate that this in fact enables CTU that does work. Demonstrate it by a CTU report.
Could you also demonstrate that the `alpha.deadcode.UnreachableCode` works otherwise to establish a baseline that its effective.

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


More information about the cfe-commits mailing list