aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/UninitializedValues.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-10-13 18:50:06 +0000
committerTed Kremenek <kremenek@apple.com>2011-10-13 18:50:06 +0000
commit9e7617220135a6f6226cf09cb242cc1b905aedb4 (patch)
tree703b7cb666fab0230627c8deb01dcfefae2d3912 /lib/Analysis/UninitializedValues.cpp
parent64a371ff8d525880e519a43fc522cbdc79fc4a89 (diff)
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 <rdar://problem/9259237>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/UninitializedValues.cpp')
-rw-r--r--lib/Analysis/UninitializedValues.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp
index 8d48fffe9f..9e98560b65 100644
--- a/lib/Analysis/UninitializedValues.cpp
+++ b/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;
}
}