Skip to content
Snippets Groups Projects
Commit 370e6e98 authored by Argyrios Kyrtzidis's avatar Argyrios Kyrtzidis
Browse files

[analyzer] Fix crash when analyzing C++ code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126013 91177308-0d34-0410-b5e6-96231b3b80d8
parent 77a4d568
No related branches found
No related tags found
No related merge requests found
......@@ -172,9 +172,8 @@ public:
I->getType()->isUnsignedIntegerType()));
}
nonloc::ConcreteInt makeIntVal(const CXXBoolLiteralExpr *E) {
return E->getValue() ? nonloc::ConcreteInt(BasicVals.getValue(1, 1, true))
: nonloc::ConcreteInt(BasicVals.getValue(0, 1, true));
nonloc::ConcreteInt makeBoolVal(const CXXBoolLiteralExpr *E) {
return makeTruthVal(E->getValue());
}
nonloc::ConcreteInt makeIntVal(const llvm::APSInt& V) {
......@@ -218,11 +217,11 @@ public:
NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
const SymExpr *rhs, QualType T);
NonLoc makeTruthVal(bool b, QualType T) {
nonloc::ConcreteInt makeTruthVal(bool b, QualType T) {
return nonloc::ConcreteInt(BasicVals.getTruthValue(b, T));
}
NonLoc makeTruthVal(bool b) {
nonloc::ConcreteInt makeTruthVal(bool b) {
return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
}
......
......@@ -45,7 +45,7 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const {
if (X)
return *X;
else
return svalBuilder.makeIntVal(cast<CXXBoolLiteralExpr>(E));
return svalBuilder.makeBoolVal(cast<CXXBoolLiteralExpr>(E));
}
case Stmt::IntegerLiteralClass: {
// In C++, this expression may have been bound to a temporary object.
......
......@@ -10,6 +10,10 @@ long f2(char *c) {
return long(c) & 1;
}
bool f3() {
return !false;
}
namespace {
struct A { };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment