summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-19 20:09:36 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-19 20:09:36 +0000
commitca7136b9acad697e8bc4979dccda4af726d06590 (patch)
tree03f909e77275763b3f1796eee1870555a5f96397 /clang/lib/Sema
parente19aa5cc52fa05dcbfbcd9767797d0ce1631b2ec (diff)
downloadbcm5719-llvm-ca7136b9acad697e8bc4979dccda4af726d06590.tar.gz
bcm5719-llvm-ca7136b9acad697e8bc4979dccda4af726d06590.zip
When normal name lookup to disambiguiate an Objective-C message send
fails to find anything, perform ivar lookup and, if we find one, consider this an instance message. llvm-svn: 101810
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index c0e04fd6d40..ad95f00d246 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -505,6 +505,16 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
switch (Result.getResultKind()) {
case LookupResult::NotFound:
+ // Normal name lookup didn't find anything. If we're in an
+ // Objective-C method, look for ivars. If we find one, we're done!
+ // FIXME: This is a hack. Ivar lookup should be part of normal lookup.
+ if (ObjCMethodDecl *Method = getCurMethodDecl()) {
+ ObjCInterfaceDecl *ClassDeclared;
+ if (Method->getClassInterface()->lookupInstanceVariable(Name,
+ ClassDeclared))
+ return ObjCInstanceMessage;
+ }
+
// Break out; we'll perform typo correction below.
break;
OpenPOWER on IntegriCloud