[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
This commit is contained in:
Artem Dergachev 2018-02-15 02:30:20 +00:00
parent b7b86127f5
commit e231bd342e
1 changed files with 6 additions and 9 deletions

View File

@ -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()) {