[clang] [analyzer] Ignoring `T v=v; ` idiom for uninitialized variable checker and dead store checker (PR #187530)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 5 04:55:53 PDT 2026
================
@@ -0,0 +1,38 @@
+// RUN: %clang_analyze_cc1 -xc %s \
+// RUN: -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN: -verify
+// RUN: %clang_analyze_cc1 -xc++ %s \
+// RUN: -analyzer-checker=core,debug.ExprInspection,deadcode.DeadStores \
+// RUN: -verify -w
+
+// Self assignment initialization in C code will be treated as nop.
+// We will not report the VarDecl, but the following DeclRefExpr if it has not
+// yet been initialized then.
----------------
steakhal wrote:
I think this is what you wanted to express.
```suggestion
// We will report the VarDecl, only if it was left uninitialized by the time of
// a subsequent DeclRefExpr.
```
https://github.com/llvm/llvm-project/pull/187530
More information about the cfe-commits
mailing list