From e231bd342eacb2fe84af9d563c77ea4be5e1f250 Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Thu, 15 Feb 2018 02:30:20 +0000 Subject: [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 --- clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Core') 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(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()) { -- cgit v1.2.3