Enhance SimpleSValuator to handle nonloc::LocAsInteger -> location casts.

llvm-svn: 76481
This commit is contained in:
Ted Kremenek 2009-07-20 21:39:27 +00:00
parent d04f088345
commit aadd463e0e
1 changed files with 8 additions and 3 deletions

View File

@ -44,11 +44,16 @@ SValuator *clang::CreateSimpleSValuator(ValueManager &valMgr) {
// Transfer function for Casts.
//===----------------------------------------------------------------------===//
SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) {
SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) {
bool isLocType = Loc::IsLocType(castTy);
if (isLocType)
if (nonloc::LocAsInteger *LI = dyn_cast<nonloc::LocAsInteger>(&val))
return LI->getLoc();
if (!isa<nonloc::ConcreteInt>(val))
return UnknownVal();
bool isLocType = Loc::IsLocType(castTy);
// Only handle casts from integers to integers.
if (!isLocType && !castTy->isIntegerType())