[cfe-commits] r126013 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h lib/StaticAnalyzer/Core/Environment.cpp test/Analysis/cxx-crashes.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Feb 18 17:59:41 PST 2011
Author: akirtzidis
Date: Fri Feb 18 19:59:41 2011
New Revision: 126013
URL: http://llvm.org/viewvc/llvm-project?rev=126013&view=rev
Log:
[analyzer] Fix crash when analyzing C++ code.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
cfe/trunk/test/Analysis/cxx-crashes.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h?rev=126013&r1=126012&r2=126013&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h Fri Feb 18 19:59:41 2011
@@ -172,9 +172,8 @@
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 @@
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));
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp?rev=126013&r1=126012&r2=126013&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp Fri Feb 18 19:59:41 2011
@@ -45,7 +45,7 @@
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.
Modified: cfe/trunk/test/Analysis/cxx-crashes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cxx-crashes.cpp?rev=126013&r1=126012&r2=126013&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/cxx-crashes.cpp (original)
+++ cfe/trunk/test/Analysis/cxx-crashes.cpp Fri Feb 18 19:59:41 2011
@@ -10,6 +10,10 @@
return long(c) & 1;
}
+bool f3() {
+ return !false;
+}
+
namespace {
struct A { };
More information about the cfe-commits
mailing list