aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/AttrNonNullChecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Checker/AttrNonNullChecker.cpp')
-rw-r--r--lib/Checker/AttrNonNullChecker.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Checker/AttrNonNullChecker.cpp b/lib/Checker/AttrNonNullChecker.cpp
index 471cf19717..d0bccb27b4 100644
--- a/lib/Checker/AttrNonNullChecker.cpp
+++ b/lib/Checker/AttrNonNullChecker.cpp
@@ -60,11 +60,16 @@ void AttrNonNullChecker::PreVisitCallExpr(CheckerContext &C,
if (!Att->isNonNull(idx))
continue;
- const DefinedSVal &V = cast<DefinedSVal>(state->getSVal(*I));
+ SVal V = state->getSVal(*I);
+ DefinedSVal *DV = dyn_cast<DefinedSVal>(&V);
+
+ // If the value is unknown or undefined, we can't perform this check.
+ if (!DV)
+ continue;
ConstraintManager &CM = C.getConstraintManager();
const GRState *stateNotNull, *stateNull;
- llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, V);
+ llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, *DV);
if (stateNull && !stateNotNull) {
// Generate an error node. Check for a null node in case