summaryrefslogtreecommitdiffstats
path: root/clang/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
commit596fa16dd3dd1454a89fa01613fedee12d852278 (patch)
treee8491db2dcca7a91a8233917150e931b71381cd0 /clang/lib/Analysis/UninitializedValues.cpp
parent7e442569dc718387e4db9a19bb13c27611b552a7 (diff)
downloadbcm5719-llvm-596fa16dd3dd1454a89fa01613fedee12d852278.tar.gz
bcm5719-llvm-596fa16dd3dd1454a89fa01613fedee12d852278.zip
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>.
llvm-svn: 141881
Diffstat (limited to 'clang/lib/Analysis/UninitializedValues.cpp')
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp6
1 files changed, 6 insertions, 0 deletions
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;
}
}
OpenPOWER on IntegriCloud