diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-01-11 02:33:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-01-11 02:33:26 +0000 |
commit | c50e6df965ff264952d8d5805d151f89c89af302 (patch) | |
tree | 152617f90a6c67ffd9d68f7d8adb4c72d5c9ddf8 /lib/Analysis/SimpleSValuator.cpp | |
parent | 1c1ae6bdaf89145648484db5dfebcd04a60595c9 (diff) |
Switch RegionStore over to using <BaseRegion+raw offset> to store
value bindings. Along with a small change to OSAtomicChecker, this
resolves <rdar://problem/7527292> and resolves some long-standing
issues with how values can be bound to the same physical address by
not have the same "key". This change is only a beginning; logically
RegionStore needs to better handle loads from addresses where the
stored value is larger/smaller/different type than the loaded value.
We handle these cases in an approximate fashion now (via
CastRetrievedVal and help in SimpleSValuator), but it could be made
much smarter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/SimpleSValuator.cpp')
-rw-r--r-- | lib/Analysis/SimpleSValuator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/SimpleSValuator.cpp b/lib/Analysis/SimpleSValuator.cpp index 2afcd3e847..8f2f5a1b13 100644 --- a/lib/Analysis/SimpleSValuator.cpp +++ b/lib/Analysis/SimpleSValuator.cpp @@ -53,13 +53,13 @@ SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) { if (isLocType) return LI->getLoc(); + // FIXME: Correctly support promotions/truncations. ASTContext &Ctx = ValMgr.getContext(); - - // FIXME: Support promotions/truncations. - if (Ctx.getTypeSize(castTy) == Ctx.getTypeSize(Ctx.VoidPtrTy)) + unsigned castSize = Ctx.getTypeSize(castTy); + if (castSize == LI->getNumBits()) return val; - return UnknownVal(); + return ValMgr.makeLocAsInteger(LI->getLoc(), castSize); } if (const SymExpr *se = val.getAsSymbolicExpression()) { |