[cfe-commits] r118344 - in /cfe/trunk: lib/Analysis/FormatString.cpp test/SemaCXX/nullptr.cpp
Anders Carlsson
andersca at mac.com
Sat Nov 6 07:58:54 PDT 2010
Author: andersca
Date: Sat Nov 6 09:58:53 2010
New Revision: 118344
URL: http://llvm.org/viewvc/llvm-project?rev=118344&view=rev
Log:
Don't warn when matching %p to nullptr.
Modified:
cfe/trunk/lib/Analysis/FormatString.cpp
cfe/trunk/test/SemaCXX/nullptr.cpp
Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=118344&r1=118343&r2=118344&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Sat Nov 6 09:58:53 2010
@@ -296,8 +296,8 @@
}
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;
Modified: cfe/trunk/test/SemaCXX/nullptr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nullptr.cpp?rev=118344&r1=118343&r2=118344&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nullptr.cpp (original)
+++ cfe/trunk/test/SemaCXX/nullptr.cpp Sat Nov 6 09:58:53 2010
@@ -93,3 +93,12 @@
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);
+ }
+}
More information about the cfe-commits
mailing list