summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-02-18 07:18:28 +0000
committerTed Kremenek <kremenek@apple.com>2013-02-18 07:18:28 +0000
commit3e05be9de38b571d23d07c56667111b0d6717a65 (patch)
tree3cf5533a49cfc4f63eb80704bcd7766c35559eb5 /clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
parent9211bd33ec1c0923b992e9644cb94303b0fa3420 (diff)
downloadbcm5719-llvm-3e05be9de38b571d23d07c56667111b0d6717a65.tar.gz
bcm5719-llvm-3e05be9de38b571d23d07c56667111b0d6717a65.zip
Disable dead stores checker for template instantations. Fixes <rdar://problem/13213575>.
llvm-svn: 175425
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index e2f8395da90..f2e3e6d7815 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -419,6 +419,15 @@ class DeadStoresChecker : public Checker<check::ASTCodeBody> {
public:
void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
BugReporter &BR) const {
+
+ // Don't do anything for template instantiations.
+ // Proving that code in a template instantiation is "dead"
+ // means proving that it is dead in all instantiations.
+ // This same problem exists with -Wunreachable-code.
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
+ if (FD->isTemplateInstantiation())
+ return;
+
if (LiveVariables *L = mgr.getAnalysis<LiveVariables>(D)) {
CFG &cfg = *mgr.getCFG(D);
AnalysisDeclContext *AC = mgr.getAnalysisDeclContext(D);
OpenPOWER on IntegriCloud