RemoveDeadBindings should now check for UninitalizedVal, as it is a now

an error to cast it to LVal.

llvm-svn: 47450
This commit is contained in:
Ted Kremenek 2008-02-21 19:30:14 +00:00
parent 7328fa6ec8
commit e82c7a44d6
2 changed files with 13 additions and 2 deletions

View File

@ -94,8 +94,15 @@ ValueStateManager::RemoveDeadBindings(ValueState St, Stmt* Loc,
Marked.insert(V); Marked.insert(V);
if (V->getType()->isPointerType()) { if (V->getType()->isPointerType()) {
const LVal& LV =
cast<LVal>(GetRVal(St, lval::DeclVal(cast<VarDecl>(V)))); RVal X = GetRVal(St, lval::DeclVal(cast<VarDecl>(V)));
assert (!X.isUnknown());
if (X.isUninit())
continue;
LVal LV = cast<LVal>(X);
for (RVal::symbol_iterator SI = LV.symbol_begin(), SE = LV.symbol_end(); for (RVal::symbol_iterator SI = LV.symbol_begin(), SE = LV.symbol_end();
SI != SE; ++SI) { SI != SE; ++SI) {

View File

@ -367,6 +367,10 @@ public:
return R.isValid() ? TF->EvalBinOp(ValMgr, Op, L, cast<NonLVal>(R)) : R; return R.isValid() ? TF->EvalBinOp(ValMgr, Op, L, cast<NonLVal>(R)) : R;
} }
RVal EvalBinOp(BinaryOperator::Opcode Op, NonLVal L, NonLVal R) {
return R.isValid() ? TF->EvalBinOp(ValMgr, Op, L, R) : R;
}
RVal EvalBinOp(BinaryOperator::Opcode Op, RVal L, RVal R) { RVal EvalBinOp(BinaryOperator::Opcode Op, RVal L, RVal R) {
if (L.isUninit() || R.isUninit()) if (L.isUninit() || R.isUninit())