diff options
author | Anna Zaks <ganna@apple.com> | 2012-05-02 00:05:23 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-05-02 00:05:23 +0000 |
commit | 2a6e30d9ec947e26df55b4ea4eb5b583bb85ee96 (patch) | |
tree | eb9fe7fa6f3cf1f12a60525c33a48c7522c73578 /lib/StaticAnalyzer/Core/SValBuilder.cpp | |
parent | 93c5a24b517e65eb61481ed866b503f1e37cff20 (diff) |
[analyzer] Fix an assertion failure triggered by the analyzer buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SValBuilder.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SValBuilder.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp index 4ce9d09280..4c021a4a26 100644 --- a/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -196,25 +196,24 @@ DefinedSVal SValBuilder::getBlockPointer(const BlockDecl *block, //===----------------------------------------------------------------------===// SVal SValBuilder::makeSymExprValNN(ProgramStateRef State, - BinaryOperator::Opcode Op, - NonLoc LHS, NonLoc RHS, - QualType ResultTy) { - const SymExpr *symLHS; - const SymExpr *symRHS; - - if (const nonloc::ConcreteInt *rInt = dyn_cast<nonloc::ConcreteInt>(&RHS)) { - symLHS = LHS.getAsSymExpr(); - return makeNonLoc(symLHS, Op, rInt->getValue(), ResultTy); - } + BinaryOperator::Opcode Op, + NonLoc LHS, NonLoc RHS, + QualType ResultTy) { + const SymExpr *symLHS = LHS.getAsSymExpr(); + const SymExpr *symRHS = RHS.getAsSymExpr(); - if (const nonloc::ConcreteInt *lInt = dyn_cast<nonloc::ConcreteInt>(&LHS)) { - symRHS = RHS.getAsSymExpr(); - return makeNonLoc(lInt->getValue(), Op, symRHS, ResultTy); - } + if (symLHS && symRHS) + return makeNonLoc(symLHS, Op, symRHS, ResultTy); + + if (symLHS) + if (const nonloc::ConcreteInt *rInt = dyn_cast<nonloc::ConcreteInt>(&RHS)) + return makeNonLoc(symLHS, Op, rInt->getValue(), ResultTy); - symLHS = LHS.getAsSymExpr(); - symRHS = RHS.getAsSymExpr(); - return makeNonLoc(symLHS, Op, symRHS, ResultTy); + if (symRHS) + if (const nonloc::ConcreteInt *lInt = dyn_cast<nonloc::ConcreteInt>(&LHS)) + return makeNonLoc(lInt->getValue(), Op, symRHS, ResultTy); + + return UnknownVal(); } |