Added transfer function support for casting to "void".

llvm-svn: 47333
This commit is contained in:
Ted Kremenek 2008-02-19 18:47:04 +00:00
parent a0b1cc41ef
commit fe0b5740ce
2 changed files with 10 additions and 2 deletions

View File

@ -449,8 +449,9 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst) {
QualType T = CastE->getType();
// Check for redundant casts.
if (E->getType() == T ||
// Check for redundant casts or casting to "void"
if (T->isVoidType() ||
E->getType() == T ||
(T->isPointerType() && E->getType()->isFunctionType())) {
Dst.Add(Pred);
return;

View File

@ -252,6 +252,10 @@ RValue ValueStateManager::GetValue(ValueState St, Expr* E, bool* hasVal) {
case Stmt::ImplicitCastExprClass: {
ImplicitCastExpr* C = cast<ImplicitCastExpr>(E);
QualType CT = C->getType();
if (CT->isVoidType())
return UnknownVal();
QualType ST = C->getSubExpr()->getType();
if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
@ -266,6 +270,9 @@ RValue ValueStateManager::GetValue(ValueState St, Expr* E, bool* hasVal) {
QualType CT = C->getType();
QualType ST = C->getSubExpr()->getType();
if (CT->isVoidType())
return UnknownVal();
if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
E = C->getSubExpr();
continue;