summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/SimpleSValuator.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-09-25 00:18:15 +0000
committerTed Kremenek <kremenek@apple.com>2009-09-25 00:18:15 +0000
commitf694f421e1c906ef24d6d35c026346171c489609 (patch)
tree9f426a0747b577e93276e2e0b0b52b3ae18211e5 /clang/lib/Analysis/SimpleSValuator.cpp
parent6f95c705ea241b19c5562dca4fde0651d4759941 (diff)
downloadbcm5719-llvm-f694f421e1c906ef24d6d35c026346171c489609.tar.gz
bcm5719-llvm-f694f421e1c906ef24d6d35c026346171c489609.zip
Fix <rdar://problem/7249327> by allowing silent conversions between signed and unsigned integer values for symbolic values. This is an intermediate solution (i.e. hack) until we support extension/truncation of symbolic integers.
llvm-svn: 82737
Diffstat (limited to 'clang/lib/Analysis/SimpleSValuator.cpp')
-rw-r--r--clang/lib/Analysis/SimpleSValuator.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Analysis/SimpleSValuator.cpp b/clang/lib/Analysis/SimpleSValuator.cpp
index 6d944da45b0..52a591927df 100644
--- a/clang/lib/Analysis/SimpleSValuator.cpp
+++ b/clang/lib/Analysis/SimpleSValuator.cpp
@@ -68,6 +68,15 @@ SVal SimpleSValuator::EvalCastNL(NonLoc val, QualType castTy) {
QualType T = Ctx.getCanonicalType(se->getType(Ctx));
if (T == Ctx.getCanonicalType(castTy))
return val;
+
+ // FIXME: Remove this hack when we support symbolic truncation/extension.
+ // HACK: If both castTy and T are integers, ignore the cast. This is
+ // not a permanent solution. Eventually we want to precisely handle
+ // extension/truncation of symbolic integers. This prevents us from losing
+ // precision when we assign 'x = y' and 'y' is symbolic and x and y are
+ // different integer types.
+ if (T->isIntegerType() && castTy->isIntegerType())
+ return val;
return UnknownVal();
}
OpenPOWER on IntegriCloud