[cfe-commits] r126536 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp test/Rewriter/rewrite-vararg.m

Fariborz Jahanian fjahanian at apple.com
Fri Feb 25 17:31:36 PST 2011


Author: fjahanian
Date: Fri Feb 25 19:31:36 2011
New Revision: 126536

URL: http://llvm.org/viewvc/llvm-project?rev=126536&view=rev
Log:
Fix objc rewriting bug casting to qualified objective-c pointetr.
// rdar://9056351

Added:
    cfe/trunk/test/Rewriter/rewrite-vararg.m
Modified:
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=126536&r1=126535&r2=126536&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Fri Feb 25 19:31:36 2011
@@ -2988,9 +2988,9 @@
     // Make all implicit casts explicit...ICE comes in handy:-)
     if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(userExpr)) {
       // Reuse the ICE type, it is exactly what the doctor ordered.
-      QualType type = ICE->getType()->isObjCQualifiedIdType()
-                                ? Context->getObjCIdType()
-                                : ICE->getType();
+      QualType type = ICE->getType();
+      if (needToScanForQualifiers(type))
+        type = Context->getObjCIdType();
       // Make sure we convert "type (^)(...)" to "type (*)(...)".
       (void)convertBlockPointerToFunctionPointer(type);
       userExpr = NoTypeInfoCStyleCastExpr(Context, type, CK_BitCast,

Added: cfe/trunk/test/Rewriter/rewrite-vararg.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-vararg.m?rev=126536&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-vararg.m (added)
+++ cfe/trunk/test/Rewriter/rewrite-vararg.m Fri Feb 25 19:31:36 2011
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+
+// rdar://9056351
+void *sel_registerName(const char *);
+
+ at interface NSObject @end
+ at class NSString;
+
+ at protocol P
+  -(void)ParliamentFunkadelic;
+ at end
+	
+ at interface Foo {
+  NSObject <P> *_dataSource;
+}
+ at end
+	
+ at interface Bar { }
++(void)WhateverBar:(NSString*)format, ...;
+ at end
+	
+ at implementation Foo
+-(void)WhateverFoo {
+	[Bar WhateverBar:@"ISyncSessionDriverDataSource %@ responded poorly", _dataSource];
+}
+ at end





More information about the cfe-commits mailing list