diff options
-rw-r--r-- | clang/lib/Analysis/FormatString.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/format-strings-objc.m | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Analysis/FormatString.cpp b/clang/lib/Analysis/FormatString.cpp index dd2f2406d46..ba45865af87 100644 --- a/clang/lib/Analysis/FormatString.cpp +++ b/clang/lib/Analysis/FormatString.cpp @@ -337,7 +337,7 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const { case CPointerTy: return argTy->isPointerType() || argTy->isObjCObjectPointerType() || - argTy->isNullPtrType(); + argTy->isBlockPointerType() || argTy->isNullPtrType(); case ObjCPointerTy: { if (argTy->getAs<ObjCObjectPointerType>() || diff --git a/clang/test/SemaObjC/format-strings-objc.m b/clang/test/SemaObjC/format-strings-objc.m index a2a926c7d01..b9c22413999 100644 --- a/clang/test/SemaObjC/format-strings-objc.m +++ b/clang/test/SemaObjC/format-strings-objc.m @@ -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 @@ void test_toll_free_bridging(CFStringRef x) { } @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 +} + |