[cfe-commits] r125061 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/property-dot-receiver.m

Fariborz Jahanian fjahanian at apple.com
Mon Feb 7 16:23:07 PST 2011


Author: fjahanian
Date: Mon Feb  7 18:23:07 2011
New Revision: 125061

URL: http://llvm.org/viewvc/llvm-project?rev=125061&view=rev
Log:
Support for objc use of property-dot syntax as receiver
in liu of a class method getter. objc++ uses a different
code path and is more involved (TBD).

Added:
    cfe/trunk/test/SemaObjC/property-dot-receiver.m
Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=125061&r1=125060&r2=125061&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Feb  7 18:23:07 2011
@@ -675,6 +675,10 @@
     return ObjCInstanceMessage;
 
   case LookupResult::Found: {
+    // If the identifier is a class or not, and there is a trailing dot,
+    // it's an instance message.
+    if (HasTrailingDot)
+      return ObjCInstanceMessage;
     // We found something. If it's a type, then we have a class
     // message. Otherwise, it's an instance message.
     NamedDecl *ND = Result.getFoundDecl();

Added: cfe/trunk/test/SemaObjC/property-dot-receiver.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-dot-receiver.m?rev=125061&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-dot-receiver.m (added)
+++ cfe/trunk/test/SemaObjC/property-dot-receiver.m Mon Feb  7 18:23:07 2011
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s 
+// rdar://8962253
+
+ at interface Singleton {
+}
++ (Singleton*) instance;
+ at end
+
+ at implementation Singleton
+
+- (void) someSelector { }
+
++ (Singleton*) instance { return 0; }
+
++ (void) compileError
+{
+     [Singleton.instance  someSelector]; // clang issues error here
+}
+
+ at end
+





More information about the cfe-commits mailing list