[analyzer] Remove dead optimization for MaterializeTemporaryExpr.

Previously, we tried to avoid creating new temporary object regions if
the value to be materialized itself came from a temporary object region.
However, once we became more strict about lvalues vs. rvalues (months
ago), this optimization became dead code, because the input to this
function will always be an rvalue (i.e. a symbolic value or compound
value rather than a region, at least for structs).

This would be a nice optimization to keep, but removing it makes it
simpler to reason about temporary regions.

llvm-svn: 187160
This commit is contained in:
Jordan Rose 2013-07-25 22:32:35 +00:00
parent 13235dadab
commit a7e7e7a2f6
1 changed files with 1 additions and 15 deletions

View File

@ -30,21 +30,7 @@ void ExprEngine::CreateCXXTemporaryObject(const MaterializeTemporaryExpr *ME,
ProgramStateRef state = Pred->getState();
const LocationContext *LCtx = Pred->getLocationContext();
SVal V = state->getSVal(tempExpr, LCtx);
// If the value is already a CXXTempObjectRegion, it is fine as it is.
// Otherwise, create a new CXXTempObjectRegion, and copy the value into it.
// This is an optimization for when an rvalue is constructed and then
// immediately materialized.
const MemRegion *MR = V.getAsRegion();
if (const CXXTempObjectRegion *TR =
dyn_cast_or_null<CXXTempObjectRegion>(MR)) {
if (getContext().hasSameUnqualifiedType(TR->getValueType(), ME->getType()))
state = state->BindExpr(ME, LCtx, V);
}
if (state == Pred->getState())
state = createTemporaryRegionIfNeeded(state, LCtx, tempExpr, ME);
state = createTemporaryRegionIfNeeded(state, LCtx, tempExpr, ME);
Bldr.generateNode(ME, Pred, state);
}