]> granicus.if.org Git - clang/commitdiff
Revert r133024, "[format strings] correctly suggest correct type for '%@'
authorDaniel Dunbar <daniel@zuster.org>
Tue, 28 Jun 2011 23:33:55 +0000 (23:33 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 28 Jun 2011 23:33:55 +0000 (23:33 +0000)
specifiers.  Fixes <rdar://problem/9607158>." because it causes false positives
on some code that uses CF toll free bridging.
 - I'll let Doug or Ted figure out the right fix here, possibly just to accept
   any pointer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134041 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/FormatString.cpp
lib/Analysis/PrintfFormatString.cpp
test/SemaObjC/format-strings-objc.m

index be214e0d86d488ef0e7c2aa3339374be584a9237..c1b5ea8a652a7c4849fb76358ae2d0a12d46e266 100644 (file)
@@ -300,8 +300,7 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
         argTy->isNullPtrType();
 
     case ObjCPointerTy:
-      return argTy->getAs<ObjCObjectPointerType>() != NULL ||
-             argTy->getAs<BlockPointerType>() != NULL;
+      return argTy->getAs<ObjCObjectPointerType>() != NULL;
   }
 
   // FIXME: Should be unreachable, but Clang is currently emitting
index 270308a08f215fc5501061f9afb29a4a8a37a9e7..00b0b279e4a0f866904a7d27ad70dcacf052322f 100644 (file)
@@ -348,8 +348,6 @@ ArgTypeResult PrintfSpecifier::getArgType(ASTContext &Ctx) const {
       return Ctx.WCharTy;
     case ConversionSpecifier::pArg:
       return ArgTypeResult::CPointerTy;
-    case ConversionSpecifier::ObjCObjArg:
-      return ArgTypeResult::ObjCPointerTy;
     default:
       break;
   }
index dd49cf7a936de4ed12e96f9933ceb46d54844ad7..d89f50afa968a8bafa9ebe1dac9a120cb4cb3382 100644 (file)
@@ -38,7 +38,6 @@ int printf(const char * restrict, ...) ;
 void check_nslog(unsigned k) {
   NSLog(@"%d%%", k); // no-warning
   NSLog(@"%s%lb%d", "unix", 10,20); // expected-warning {{invalid conversion specifier 'b'}}
-  NSLog(@"%@", "a"); // expected-warning {{conversion specifies type 'id' but the argument has type 'char *'}}
 }
 
 // Check type validation