[cfe-commits] r95392 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-message-expr.mm

Fariborz Jahanian fjahanian at apple.com
Fri Feb 5 09:48:10 PST 2010


Author: fjahanian
Date: Fri Feb  5 11:48:10 2010
New Revision: 95392

URL: http://llvm.org/viewvc/llvm-project?rev=95392&view=rev
Log:
Fixes a minor rewriter bug messaging inside a function call.
Fixes radar 7617047.

Added:
    cfe/trunk/test/Rewriter/rewrite-message-expr.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=95392&r1=95391&r2=95392&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Feb  5 11:48:10 2010
@@ -1310,7 +1310,11 @@
     Stmt *newStmt = RewriteObjCIvarRefExpr(IvarRefExpr, OrigStmtRange.getBegin(),
                                            replaced);
     return newStmt;
-  }  
+  } 
+  if (ObjCMessageExpr *MsgRefExpr = dyn_cast<ObjCMessageExpr>(S)) {
+    Stmt *newStmt = SynthMessageExpr(MsgRefExpr);
+    return newStmt;
+  }
   return S;
 }
 

Added: cfe/trunk/test/Rewriter/rewrite-message-expr.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-message-expr.mm?rev=95392&view=auto

==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-message-expr.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-message-expr.mm Fri Feb  5 11:48:10 2010
@@ -0,0 +1,27 @@
+// 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 7617047
+
+#include <objc/objc.h>
+
+ at interface Baz
+- (id)y;
++ (id)z;
+ at end
+
+ at interface Foo {
+ at public
+	int bar;
+}
+ at end
+
+extern Foo* x(id a);
+
+int f(Baz *baz) {
+	int i = x([Baz z])->bar;
+        int j = ((Foo*)[Baz z])->bar;
+        int k = x([baz y])->bar;
+        return i+j+k;
+}
+
+// CHECK-LP: ((struct Foo_IMPL *)x(((id (*)(id, SEL))(void *)objc_msgSend)(objc_getClass("Baz"), sel_registerName("z"))))->bar





More information about the cfe-commits mailing list