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
This commit is contained in:
Douglas Gregor 2010-04-19 20:09:36 +00:00
parent e19aa5cc52
commit ca7136b9ac
1 changed files with 10 additions and 0 deletions

View File

@ -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;