summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-01-13 20:58:56 +0000
committerTed Kremenek <kremenek@apple.com>2011-01-13 20:58:56 +0000
commitf224820b45c6847b91071da8d7ade59f373b96f3 (patch)
treeec7a7d11677d35feb165f34d62dfb86c84a28637 /clang/lib/StaticAnalyzer/Checkers
parentb084be90e8ae5e77d1d8e06e4d0cfc79b7db236d (diff)
downloadbcm5719-llvm-f224820b45c6847b91071da8d7ade59f373b96f3.tar.gz
bcm5719-llvm-f224820b45c6847b91071da8d7ade59f373b96f3.zip
Remove warning in dead stores checker for
dead stores within nested assignments. I have never seen an actual bug found by this specific warning, and it can lead to many false positives. llvm-svn: 123394
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckDeadStores.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckDeadStores.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckDeadStores.cpp
index 1fe40c56e83..96c0dd426c0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckDeadStores.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckDeadStores.cpp
@@ -1,4 +1,4 @@
-//==- DeadStores.cpp - Check for stores to dead variables --------*- C++ -*-==//
+//==- DeadStoresChecker.cpp - Check for stores to dead variables -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -70,11 +70,10 @@ public:
break;
case Enclosing:
- BugType = "Dead nested assignment";
- msg = "Although the value stored to '" + name +
- "' is used in the enclosing expression, the value is never actually"
- " read from '" + name + "'";
- break;
+ // Don't report issues in this case, e.g.: "if (x = foo())",
+ // where 'x' is unused later. We have yet to see a case where
+ // this is a real bug.
+ return;
}
BR.EmitBasicReport(BugType, "Dead store", msg, L, R);
OpenPOWER on IntegriCloud