[cfe-commits] r152839 - in /cfe/trunk: lib/Analysis/FormatString.cpp test/SemaObjC/format-strings-objc.m
Ted Kremenek
kremenek at apple.com
Thu Mar 15 14:22:27 PDT 2012
Author: kremenek
Date: Thu Mar 15 16:22:27 2012
New Revision: 152839
URL: http://llvm.org/viewvc/llvm-project?rev=152839&view=rev
Log:
Support '%p' format specifier with block pointers.
Modified:
cfe/trunk/lib/Analysis/FormatString.cpp
cfe/trunk/test/SemaObjC/format-strings-objc.m
Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=152839&r1=152838&r2=152839&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Thu Mar 15 16:22:27 2012
@@ -337,7 +337,7 @@
case CPointerTy:
return argTy->isPointerType() || argTy->isObjCObjectPointerType() ||
- argTy->isNullPtrType();
+ argTy->isBlockPointerType() || argTy->isNullPtrType();
case ObjCPointerTy: {
if (argTy->getAs<ObjCObjectPointerType>() ||
Modified: cfe/trunk/test/SemaObjC/format-strings-objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/format-strings-objc.m?rev=152839&r1=152838&r2=152839&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/format-strings-objc.m (original)
+++ cfe/trunk/test/SemaObjC/format-strings-objc.m Thu Mar 15 16:22:27 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -Wformat-nonliteral -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -Wformat-nonliteral -fsyntax-only -fblocks -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
@@ -176,3 +176,13 @@
}
@end
+
+
+// Test that it is okay to use %p with the address of a block.
+void rdar11049844_aux();
+int rdar11049844() {
+ typedef void (^MyBlock)(void);
+ MyBlock x = ^void() { rdar11049844_aux(); };
+ printf("%p", x); // no-warning
+}
+
More information about the cfe-commits
mailing list