summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-15 04:12:12 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-15 04:12:12 +0000
commit29f38086677c0ba84ff1c4f2ba766f050e08d8ea (patch)
treea430788becf1a41f92e66ee8ef389c9cc51f8596 /clang/lib/Analysis
parent2151725325214dbcf8fa7914e81399205499692c (diff)
downloadbcm5719-llvm-29f38086677c0ba84ff1c4f2ba766f050e08d8ea.tar.gz
bcm5719-llvm-29f38086677c0ba84ff1c4f2ba766f050e08d8ea.zip
Until we can make the dead stores checker smarter, dont' emit dead store warnings for C++ objects (whose constructors/destructors have possible side-effects).
llvm-svn: 91412
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CheckDeadStores.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CheckDeadStores.cpp b/clang/lib/Analysis/CheckDeadStores.cpp
index ec13328447a..db9016fa1e6 100644
--- a/clang/lib/Analysis/CheckDeadStores.cpp
+++ b/clang/lib/Analysis/CheckDeadStores.cpp
@@ -186,6 +186,10 @@ public:
if (V->hasLocalStorage())
if (Expr* E = V->getInit()) {
+ // Don't warn on C++ objects (yet) until we can show that their
+ // constructors/destructors don't have side effects.
+ if (isa<CXXConstructExpr>(E))
+ return;
// A dead initialization is a variable that is dead after it
// is initialized. We don't flag warnings for those variables
// marked 'unused'.
OpenPOWER on IntegriCloud