- Remove Sema::FindMethodInNestedImplementations().

- Add ObjCInterfaceDecl::lookupPrivateInstanceMethod().
- Convert clients.

No functionality change - One less method in Sema:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83224 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steve Naroff 2009-10-01 23:46:04 +00:00
Родитель 1be8aee874
Коммит d789d3d985
4 изменённых файлов: 17 добавлений и 24 удалений

Просмотреть файл

@ -513,6 +513,9 @@ public:
return lookupMethod(Sel, false/*isInstance*/);
}
ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
// Lookup a method in the classes implementation hierarchy.
ObjCMethodDecl *lookupPrivateInstanceMethod(const Selector &Sel);
// Location information, modeled after the Stmt API.
SourceLocation getLocStart() const { return getLocation(); } // '@'interface
@ -690,7 +693,7 @@ public:
ObjCMethodDecl *lookupClassMethod(Selector Sel) const {
return lookupMethod(Sel, false/*isInstance*/);
}
bool isForwardDecl() const { return isForwardProtoDecl; }
void setForwardDecl(bool val) { isForwardProtoDecl = val; }

Просмотреть файл

@ -184,7 +184,16 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel,
return NULL;
}
ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateInstanceMethod(
const Selector &Sel) {
ObjCMethodDecl *Method = 0;
if (ObjCImplementationDecl *ImpDecl = getImplementation())
Method = ImpDecl->getInstanceMethod(Sel);
if (!Method && getSuperClass())
return getSuperClass()->lookupPrivateInstanceMethod(Sel);
return Method;
}
//===----------------------------------------------------------------------===//
// ObjCMethodDecl

Просмотреть файл

@ -1270,10 +1270,6 @@ private:
std::pair<bool, LookupResult> CppLookupName(Scope *S, DeclarationName Name,
LookupNameKind NameKind,
bool RedeclarationOnly);
ObjCMethodDecl *FindMethodInNestedImplementations(
const ObjCInterfaceDecl *IFace,
const Selector &Sel);
public:
/// Determines whether D is a suitable lookup result according to the
/// lookup criteria.

Просмотреть файл

@ -2001,21 +2001,6 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy,
return GDecl;
}
/// FindMethodInNestedImplementations - Look up a method in current and
/// all base class implementations.
///
ObjCMethodDecl *Sema::FindMethodInNestedImplementations(
const ObjCInterfaceDecl *IFace,
const Selector &Sel) {
ObjCMethodDecl *Method = 0;
if (ObjCImplementationDecl *ImpDecl = IFace->getImplementation())
Method = ImpDecl->getInstanceMethod(Sel);
if (!Method && IFace->getSuperClass())
return FindMethodInNestedImplementations(IFace->getSuperClass(), Sel);
return Method;
}
Action::OwningExprResult
Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
tok::TokenKind OpKind, SourceLocation MemberLoc,
@ -2075,7 +2060,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
if (!Setter) {
// If this reference is in an @implementation, also check for 'private'
// methods.
Setter = FindMethodInNestedImplementations(IFace, SetterSel);
Setter = IFace->lookupPrivateInstanceMethod(SetterSel);
}
// Look through local category implementations associated with the class.
if (!Setter)
@ -2526,7 +2511,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
// If this reference is in an @implementation, check for 'private' methods.
if (!Getter)
Getter = FindMethodInNestedImplementations(IFace, Sel);
Getter = IFace->lookupPrivateInstanceMethod(Sel);
// Look through local category implementations associated with the class.
if (!Getter)
@ -2545,7 +2530,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
if (!Setter) {
// If this reference is in an @implementation, also check for 'private'
// methods.
Setter = FindMethodInNestedImplementations(IFace, SetterSel);
Setter = IFace->lookupPrivateInstanceMethod(SetterSel);
}
// Look through local category implementations associated with the class.
if (!Setter)