[cfe-commits] r95097 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-protocol-qualified.mm

Fariborz Jahanian fjahanian at apple.com
Tue Feb 2 10:35:08 PST 2010


Author: fjahanian
Date: Tue Feb  2 12:35:07 2010
New Revision: 95097

URL: http://llvm.org/viewvc/llvm-project?rev=95097&view=rev
Log:
Fix up rewriting of protocol qualified types in objc rewriter.
Fixes radar 7589414.


Added:
    cfe/trunk/test/Rewriter/rewrite-protocol-qualified.mm
Modified:
    cfe/trunk/lib/Frontend/RewriteObjC.cpp

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=95097&r1=95096&r2=95097&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Tue Feb  2 12:35:07 2010
@@ -1995,7 +1995,15 @@
 }
 
 bool RewriteObjC::needToScanForQualifiers(QualType T) {
-  return T->isObjCQualifiedIdType() || T->isObjCQualifiedInterfaceType();
+  if (const PointerType *PT = T->getAs<PointerType>()) {
+    if (PT->getPointeeType()->isObjCQualifiedIdType())
+      return true;
+  }
+  if (T->isObjCObjectPointerType()) {
+    T = T->getPointeeType();
+    return T->isObjCQualifiedInterfaceType();
+  }
+  return false;
 }
 
 void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Expr *E) {

Added: cfe/trunk/test/Rewriter/rewrite-protocol-qualified.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-protocol-qualified.mm?rev=95097&view=auto

==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-protocol-qualified.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-protocol-qualified.mm Tue Feb  2 12:35:07 2010
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
+// radar 7589414
+
+ at protocol NSPortDelegate;
+ at interface NSConnection @end
+
+ at interface NSMessagePort
+- (void) clone;
+ at end
+
+ at implementation NSMessagePort
+- (void) clone {
+     NSConnection <NSPortDelegate> *conn = 0;
+     id <NSPortDelegate> *idc = 0;
+}
+ at end
+
+// CHECK-LP: NSConnection /*<NSPortDelegate>*/ *conn = 0; 
+
+// CHECK-LP: id /*<NSPortDelegate>*/ *idc = 0; 





More information about the cfe-commits mailing list