[clang] [analyzer] Ignoring `T v=v; ` idiom for uninitialized variable checker and dead store checker (PR #187530)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 04:18:44 PDT 2026


================
@@ -431,6 +431,12 @@ class DeadStoreObs : public LiveVariables::Observer {
                   //  bug.
                   if (isa<ParmVarDecl>(VD) && VD->getType()->isScalarType())
                     return;
+                  // Special case: check for self-initializations.
+                  //
+                  //  e.g. int x = x;
+                  //
+                  if (VD == V)
----------------
AaronBallman wrote:

I don't think we need to support those cases in this PR but I do think having test coverage for them with some FIXMEs so that it's documented we thought about this.

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


More information about the cfe-commits mailing list