summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-02-08 00:23:07 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-02-08 00:23:07 +0000
commit14889fc671ee30abbdd2fd54c0a420a4e93c381b (patch)
tree6f345d48c08013dad19437c5d751586c4d6f2799 /clang
parenta3990398a3124a5ef205deba69f2641ac2ff1050 (diff)
downloadbcm5719-llvm-14889fc671ee30abbdd2fd54c0a420a4e93c381b.tar.gz
bcm5719-llvm-14889fc671ee30abbdd2fd54c0a420a4e93c381b.zip
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). llvm-svn: 125061
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp4
-rw-r--r--clang/test/SemaObjC/property-dot-receiver.m21
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index eeaa45163d5..11fa9eb0b42 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -675,6 +675,10 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
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();
diff --git a/clang/test/SemaObjC/property-dot-receiver.m b/clang/test/SemaObjC/property-dot-receiver.m
new file mode 100644
index 00000000000..3498dcc0298
--- /dev/null
+++ b/clang/test/SemaObjC/property-dot-receiver.m
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8962253
+
+@interface Singleton {
+}
++ (Singleton*) instance;
+@end
+
+@implementation Singleton
+
+- (void) someSelector { }
+
++ (Singleton*) instance { return 0; }
+
++ (void) compileError
+{
+ [Singleton.instance someSelector]; // clang issues error here
+}
+
+@end
+
OpenPOWER on IntegriCloud