forked from OSchip/llvm-project
handle CXXFunctionalCastExpr in visitLValue and Environment.
llvm-svn: 120143
This commit is contained in:
parent
7514633c26
commit
33f13595c9
|
@ -79,6 +79,10 @@ SVal Environment::GetSVal(const Stmt *E, ValueManager& ValMgr) const {
|
|||
E = cast<CXXBindTemporaryExpr>(E)->getSubExpr();
|
||||
continue;
|
||||
|
||||
case Stmt::CXXFunctionalCastExprClass:
|
||||
E = cast<CXXFunctionalCastExpr>(E)->getSubExpr();
|
||||
continue;
|
||||
|
||||
// Handle all other Stmt* using a lookup.
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1158,6 +1158,18 @@ void GRExprEngine::VisitLValue(const Expr* Ex, ExplodedNode* Pred,
|
|||
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);
|
||||
|
|
|
@ -17,3 +17,14 @@ void f1() {
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue