From 596fa16dd3dd1454a89fa01613fedee12d852278 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 13 Oct 2011 18:50:06 +0000 Subject: Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes . llvm-svn: 141881 --- clang/lib/Analysis/UninitializedValues.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Analysis') diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index 8d48fffe9f2..9e98560b655 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -484,11 +484,17 @@ void TransferFunctions::VisitDeclStmt(DeclStmt *ds) { vals[vd] = Uninitialized; lastLoad = 0; lastDR = 0; + if (handler) + handler->handleSelfInit(vd); return; } } // All other cases: treat the new variable as initialized. + // This is a minor optimization to reduce the propagation + // of the analysis, since we will have already reported + // the use of the uninitialized value (which visiting the + // initializer). vals[vd] = Initialized; } } -- cgit v1.2.3