[llvm-branch-commits] [cfe-branch] r115220 - in /cfe/branches/Apple/whitney: lib/Parse/ParseExpr.cpp test/SemaObjCXX/message.mm

Daniel Dunbar daniel at zuster.org
Thu Sep 30 15:19:25 PDT 2010


Author: ddunbar
Date: Thu Sep 30 17:19:25 2010
New Revision: 115220

URL: http://llvm.org/viewvc/llvm-project?rev=115220&view=rev
Log:
Merge r114968:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Tue Sep 28 17:48:56 2010 +0000

    When we have two identifiers in a row in Objective-C, make sure to
    verify that we aren't in a message-send expression before digging into
    the identifier or looking ahead more tokens. Fixes a regression
    (<rdar://problem/8483253>) I introduced with bracket insertion.

Modified:
    cfe/branches/Apple/whitney/lib/Parse/ParseExpr.cpp
    cfe/branches/Apple/whitney/test/SemaObjCXX/message.mm

Modified: cfe/branches/Apple/whitney/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Parse/ParseExpr.cpp?rev=115220&r1=115219&r2=115220&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Parse/ParseExpr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Parse/ParseExpr.cpp Thu Sep 30 17:19:25 2010
@@ -671,7 +671,7 @@
     // If we have an Objective-C class name followed by an identifier and
     // either ':' or ']', this is an Objective-C class message send that's
     // missing the opening '['. Recovery appropriately.
-    if (getLang().ObjC1 && Tok.is(tok::identifier)) {
+    if (getLang().ObjC1 && Tok.is(tok::identifier) && !InMessageExpression) {
       const Token& Next = NextToken();
       if (Next.is(tok::colon) || Next.is(tok::r_square))
         if (ParsedType Typ = Actions.getTypeName(II, ILoc, getCurScope()))

Modified: cfe/branches/Apple/whitney/test/SemaObjCXX/message.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjCXX/message.mm?rev=115220&r1=115219&r2=115220&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjCXX/message.mm (original)
+++ cfe/branches/Apple/whitney/test/SemaObjCXX/message.mm Thu Sep 30 17:19:25 2010
@@ -92,3 +92,23 @@
   [i5 method:"hello" other:s];
   [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'const char [6]'}}
 }
+
+// <rdar://problem/8483253>
+ at interface A
+
+struct X { };
+
++ (A *)create:(void (*)(void *x, X r, void *data))callback
+	      callbackData:(void *)callback_data;
+
+ at end
+
+
+void foo(void)
+{
+  void *fun;
+  void *ptr;
+  X r;
+  A *im = [A create:(void (*)(void *cgl_ctx, X r, void *data)) fun
+             callbackData:ptr];
+}





More information about the llvm-branch-commits mailing list