summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ValueManager.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-21 21:03:30 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-21 21:03:30 +0000
commitac7c7240f0baaae27cceed4084e789d70ef14ec2 (patch)
tree14dc1b6e0bc90cb318e47d24c85a3a4c7e4e1681 /clang/lib/Analysis/ValueManager.cpp
parentdf3f1447e424b6c1d2e5647b63afb5b52a41fc3e (diff)
downloadbcm5719-llvm-ac7c7240f0baaae27cceed4084e789d70ef14ec2.tar.gz
bcm5719-llvm-ac7c7240f0baaae27cceed4084e789d70ef14ec2.zip
Fix PR 4594 by refactoring almost all casting logic from GRExprEngine::VisitCast
to SValuator::EvalCast. In the process, the StoreManagers now use this new cast machinery, and the hack in GRExprEngine::EvalBind to handle implicit casts involving OSAtomicCompareAndSwap and friends has been removed (and replaced with logic closer to the logic specific to those functions). llvm-svn: 76641
Diffstat (limited to 'clang/lib/Analysis/ValueManager.cpp')
-rw-r--r--clang/lib/Analysis/ValueManager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/ValueManager.cpp b/clang/lib/Analysis/ValueManager.cpp
index 658dfa1186c..ee6b5cbeeb3 100644
--- a/clang/lib/Analysis/ValueManager.cpp
+++ b/clang/lib/Analysis/ValueManager.cpp
@@ -56,6 +56,9 @@ NonLoc ValueManager::makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
SVal ValueManager::convertToArrayIndex(SVal V) {
+ if (V.isUnknownOrUndef())
+ return V;
+
// Common case: we have an appropriately sized integer.
if (nonloc::ConcreteInt* CI = dyn_cast<nonloc::ConcreteInt>(&V)) {
const llvm::APSInt& I = CI->getValue();
@@ -63,7 +66,7 @@ SVal ValueManager::convertToArrayIndex(SVal V) {
return V;
}
- return SVator->EvalCast(V, ArrayIndexTy);
+ return SVator->EvalCastNL(cast<NonLoc>(V), ArrayIndexTy);
}
SVal ValueManager::getRegionValueSymbolVal(const MemRegion* R, QualType T) {
OpenPOWER on IntegriCloud