aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/SValuator.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-02 21:11:40 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-02 21:11:40 +0000
commitf68170481d4c36e1e930ee9a3bce58e2ae5a95cb (patch)
tree6dd1f966f9db86d23da5775f77a9a63830269256 /lib/Checker/SValuator.cpp
parent13c5c23d3e84ecfd37944a2773f72e4840225f90 (diff)
Explicitly check for casts to double or complex types instead of possibly asserting in SValuator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/SValuator.cpp')
-rw-r--r--lib/Checker/SValuator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Checker/SValuator.cpp b/lib/Checker/SValuator.cpp
index 66cd3193b1..fd2bbd06fb 100644
--- a/lib/Checker/SValuator.cpp
+++ b/lib/Checker/SValuator.cpp
@@ -66,6 +66,12 @@ SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state,
if (C.hasSameUnqualifiedType(castTy, originalTy))
return CastResult(state, val);
+ // Check for casts to real or complex numbers. We don't handle these at all
+ // right now.
+ if (castTy->isFloatingType() || castTy->isAnyComplexType())
+ return CastResult(state, UnknownVal());
+
+ // Check for casts from integers to integers.
if (castTy->isIntegerType() && originalTy->isIntegerType())
return CastResult(state, EvalCastNL(cast<NonLoc>(val), castTy));