Support '%p' format specifier with block pointers.

llvm-svn: 152839
This commit is contained in:
Ted Kremenek 2012-03-15 21:22:27 +00:00
parent c564440f15
commit c08c475fe0
2 changed files with 12 additions and 2 deletions

View File

@ -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>() ||

View File

@ -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
}