[cfe-commits] r134041 - in /cfe/trunk: lib/Analysis/FormatString.cpp lib/Analysis/PrintfFormatString.cpp test/SemaObjC/format-strings-objc.m

Daniel Dunbar daniel at zuster.org
Tue Jun 28 16:33:55 PDT 2011


Author: ddunbar
Date: Tue Jun 28 18:33:55 2011
New Revision: 134041

URL: http://llvm.org/viewvc/llvm-project?rev=134041&view=rev
Log:
Revert r133024, "[format strings] correctly suggest correct type for '%@'
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.

Modified:
    cfe/trunk/lib/Analysis/FormatString.cpp
    cfe/trunk/lib/Analysis/PrintfFormatString.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=134041&r1=134040&r2=134041&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Tue Jun 28 18:33:55 2011
@@ -300,8 +300,7 @@
         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

Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=134041&r1=134040&r2=134041&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Tue Jun 28 18:33:55 2011
@@ -348,8 +348,6 @@
       return Ctx.WCharTy;
     case ConversionSpecifier::pArg:
       return ArgTypeResult::CPointerTy;
-    case ConversionSpecifier::ObjCObjArg:
-      return ArgTypeResult::ObjCPointerTy;
     default:
       break;
   }

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=134041&r1=134040&r2=134041&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/format-strings-objc.m (original)
+++ cfe/trunk/test/SemaObjC/format-strings-objc.m Tue Jun 28 18:33:55 2011
@@ -38,7 +38,6 @@
 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





More information about the cfe-commits mailing list