From a4bc1e625200c956241403cd6fb320b9eea336ce Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Thu, 15 Feb 2018 02:30:20 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325201 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 3135140287..1ff1ea49b7 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -138,15 +138,12 @@ ExprEngine::getRegionForConstructedObject(const CXXConstructExpr *CE, } } } else if (auto *DS = dyn_cast(TriggerStmt)) { - if (const auto *Var = dyn_cast(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(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()) { -- 2.40.0