Don't warn when matching %p to nullptr.

llvm-svn: 118344
This commit is contained in:
Anders Carlsson 2010-11-06 14:58:53 +00:00
parent 63abc84630
commit 3fd50319d3
2 changed files with 11 additions and 2 deletions

View File

@ -296,8 +296,8 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
}
case CPointerTy:
return argTy->getAs<PointerType>() != NULL ||
argTy->getAs<ObjCObjectPointerType>() != NULL;
return argTy->isPointerType() || argTy->isObjCObjectPointerType() ||
argTy->isNullPtrType();
case ObjCPointerTy:
return argTy->getAs<ObjCObjectPointerType>() != NULL;

View File

@ -93,3 +93,12 @@ namespace test2 {
f(10, nullptr);
}
}
namespace test3 {
void f(const char*, ...) __attribute__((format(printf, 1, 2)));
void g() {
// Don't warn when using nullptr with %p.
f("%p", nullptr);
}
}