[cfe-commits] r120143 - in /cfe/trunk: lib/Checker/Environment.cpp lib/Checker/GRExprEngine.cpp test/Analysis/method-call.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Nov 24 19:18:57 PST 2010
Author: zhongxingxu
Date: Wed Nov 24 21:18:57 2010
New Revision: 120143
URL: http://llvm.org/viewvc/llvm-project?rev=120143&view=rev
Log:
handle CXXFunctionalCastExpr in visitLValue and Environment.
Modified:
cfe/trunk/lib/Checker/Environment.cpp
cfe/trunk/lib/Checker/GRExprEngine.cpp
cfe/trunk/test/Analysis/method-call.cpp
Modified: cfe/trunk/lib/Checker/Environment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/Environment.cpp?rev=120143&r1=120142&r2=120143&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/Environment.cpp (original)
+++ cfe/trunk/lib/Checker/Environment.cpp Wed Nov 24 21:18:57 2010
@@ -78,6 +78,10 @@
case Stmt::CXXBindTemporaryExprClass:
E = cast<CXXBindTemporaryExpr>(E)->getSubExpr();
continue;
+
+ case Stmt::CXXFunctionalCastExprClass:
+ E = cast<CXXFunctionalCastExpr>(E)->getSubExpr();
+ continue;
// Handle all other Stmt* using a lookup.
default:
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=120143&r1=120142&r2=120143&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Nov 24 21:18:57 2010
@@ -1158,6 +1158,18 @@
break;
}
+ case Stmt::CXXConstructExprClass: {
+ const CXXConstructExpr *expr = cast<CXXConstructExpr>(Ex);
+ VisitCXXConstructExpr(expr, 0, Pred, Dst, true);
+ break;
+ }
+
+ case Stmt::CXXFunctionalCastExprClass: {
+ const CXXFunctionalCastExpr *expr = cast<CXXFunctionalCastExpr>(Ex);
+ VisitLValue(expr->getSubExpr(), Pred, Dst);
+ break;
+ }
+
case Stmt::CXXTemporaryObjectExprClass: {
const CXXTemporaryObjectExpr *expr = cast<CXXTemporaryObjectExpr>(Ex);
VisitCXXTemporaryObjectExpr(expr, Pred, Dst, true);
Modified: cfe/trunk/test/Analysis/method-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/method-call.cpp?rev=120143&r1=120142&r2=120143&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/method-call.cpp (original)
+++ cfe/trunk/test/Analysis/method-call.cpp Wed Nov 24 21:18:57 2010
@@ -17,3 +17,14 @@
}
}
+void f2() {
+ const A &x = A(3);
+ if (x.getx() == 3) {
+ int *p = 0;
+ *p = 3; // expected-warning{{Dereference of null pointer}}
+ } else {
+ int *p = 0;
+ *p = 3; // no-warning
+ }
+}
+
More information about the cfe-commits
mailing list