Author: dergachev Date: Wed Feb 14 18:30:20 2018 New Revision: 325201 URL: http://llvm.org/viewvc/llvm-project?rev=325201&view=rev Log: [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. Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=325201&r1=325200&r2=325201&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Wed Feb 14 18:30:20 2018 @@ -138,15 +138,12 @@ ExprEngine::getRegionForConstructedObjec } } } 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()) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits