aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-10-01 23:46:04 +0000
committerSteve Naroff <snaroff@apple.com>2009-10-01 23:46:04 +0000
commitd789d3d985e28c9404e62157af46dcb7331920e0 (patch)
tree91ea9c6889bb5f4b5cd1018465ac9b56f3dd90bb
parent1be8aee8745e8b814ad2f151aa214b0ef07833db (diff)
- 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
-rw-r--r--include/clang/AST/DeclObjC.h5
-rw-r--r--lib/AST/DeclObjC.cpp11
-rw-r--r--lib/Sema/Sema.h4
-rw-r--r--lib/Sema/SemaExpr.cpp21
4 files changed, 17 insertions, 24 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 6263246acf..fec2607fac 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -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; }
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index d6e4b2c44b..4185ac1682 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -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
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index b234d56fa0..7354d7cf94 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -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.
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 414525d6c3..7b7ee820c5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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)