forked from OSchip/llvm-project
[analyzer] Fix crash when analyzing C++ code.
llvm-svn: 126013
This commit is contained in:
parent
fda3687515
commit
21f347e729
|
@ -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 { };
|
||||
|
|
Loading…
Reference in New Issue