summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-02-15 02:30:20 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-02-15 02:30:20 +0000
commite231bd342eacb2fe84af9d563c77ea4be5e1f250 (patch)
treec09aa9b5bee87445e6595c1870bb06c8246a4222 /clang/lib/StaticAnalyzer/Core
parentb7b86127f5de6403382620d265025d1058c26bad (diff)
downloadbcm5719-llvm-e231bd342eacb2fe84af9d563c77ea4be5e1f250.tar.gz
bcm5719-llvm-e231bd342eacb2fe84af9d563c77ea4be5e1f250.zip
[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.
In CFG, every DeclStmt has exactly one decl, which is always a variable. It is also pointless to check that the initializer is the constructor because that's how construction contexts work now. llvm-svn: 325201
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 31351402870..1ff1ea49b7a 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -138,15 +138,12 @@ ExprEngine::getRegionForConstructedObject(const CXXConstructExpr *CE,
}
}
} else if (auto *DS = dyn_cast<DeclStmt>(TriggerStmt)) {
- if (const auto *Var = dyn_cast<VarDecl>(DS->getSingleDecl())) {
- if (Var->getInit() && Var->getInit()->IgnoreImplicit() == CE) {
- SVal LValue = State->getLValue(Var, LCtx);
- QualType Ty = Var->getType();
- LValue = makeZeroElementRegion(
- State, LValue, Ty, CallOpts.IsArrayConstructorOrDestructor);
- return LValue.getAsRegion();
- }
- }
+ const auto *Var = cast<VarDecl>(DS->getSingleDecl());
+ SVal LValue = State->getLValue(Var, LCtx);
+ QualType Ty = Var->getType();
+ LValue = makeZeroElementRegion(State, LValue, Ty,
+ CallOpts.IsArrayConstructorOrDestructor);
+ return LValue.getAsRegion();
}
// TODO: Consider other directly initialized elements.
} else if (const CXXCtorInitializer *Init = CC->getTriggerInit()) {
OpenPOWER on IntegriCloud