aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-20 21:39:27 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-20 21:39:27 +0000
commitdd6611426b96019516ed473ce25a8664065e9865 (patch)
tree3745ec3fce6ed823224386a725b6bc83799dba7f
parent02f43e71121d1c9cc4baed7b21770b66fe1f4305 (diff)
Enhance SimpleSValuator to handle nonloc::LocAsInteger -> location casts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76481 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/SimpleSValuator.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Analysis/SimpleSValuator.cpp b/lib/Analysis/SimpleSValuator.cpp
index 58b169658d..4f8c29c071 100644
--- a/lib/Analysis/SimpleSValuator.cpp
+++ b/lib/Analysis/SimpleSValuator.cpp
@@ -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())