[cfe-commits] r41559 - /cfe/trunk/AST/Expr.cpp
Steve Naroff
snaroff at apple.com
Tue Aug 28 17:00:03 PDT 2007
Author: snaroff
Date: Tue Aug 28 19:00:02 2007
New Revision: 41559
URL: http://llvm.org/viewvc/llvm-project?rev=41559&view=rev
Log:
Re-teach Expr::isNullPointerConstant() about ImplicitCastExpr:-)
This fixes the following bug submitted by Neil...
const char *f (void) { return 0; }
..which would incorrectly warn with -pedantic enabled.
Modified:
cfe/trunk/AST/Expr.cpp
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=41559&r1=41558&r2=41559&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Tue Aug 28 19:00:02 2007
@@ -648,13 +648,8 @@
return CE->getSubExpr()->isNullPointerConstant(Ctx);
}
} else if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(this)) {
- // Check that it is a cast to void*.
- if (const PointerType *PT = dyn_cast<PointerType>(ICE->getType())) {
- QualType Pointee = PT->getPointeeType();
- if (Pointee.getQualifiers() == 0 && Pointee->isVoidType() && // to void*
- ICE->getSubExpr()->getType()->isIntegerType()) // from int.
- return ICE->getSubExpr()->isNullPointerConstant(Ctx);
- }
+ // Ignore the ImplicitCastExpr type entirely.
+ return ICE->getSubExpr()->isNullPointerConstant(Ctx);
} else if (const ParenExpr *PE = dyn_cast<ParenExpr>(this)) {
// Accept ((void*)0) as a null pointer constant, as many other
// implementations do.
More information about the cfe-commits
mailing list