aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-16 19:30:12 +0000
committerChris Lattner <sabre@nondot.org>2009-02-16 19:30:12 +0000
commit53df12d1ba68dbd071d067f8236c16fba815aad5 (patch)
treed1255846a7e12a9a42f8e09a3c58ed485860243c
parentc71e28c6a5a50d7eb00bd5f703d9a09b59412d6b (diff)
cleanup, add a getMethod() that takes a bool to indicate whether
the caller wants class or instance methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64654 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/DeclObjC.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index e297434170..45deed69dc 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -302,6 +302,9 @@ public:
// Get the local instance/class method declared in this interface.
ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel) : getClassMethod(Sel);
+ }
ObjCPropertyDecl *FindPropertyDeclaration(IdentifierInfo *PropertyId) const;
@@ -854,11 +857,13 @@ public:
void addClassMethod(ObjCMethodDecl *method) {
ClassMethods.push_back(method);
}
- // Get the instance method definition for this implementation.
+
+ // Get the local instance/class method declared in this interface.
ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
-
- // Get the class method definition for this implementation.
ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel) : getClassMethod(Sel);
+ }
void addPropertyImplementation(ObjCPropertyImplDecl *property) {
PropertyImplementations.push_back(property);
@@ -917,11 +922,8 @@ public:
///
/// Typically, instance variables are specified in the class interface,
/// *not* in the implementation. Nevertheless (for legacy reasons), we
-/// allow instance variables to be specified in the implementation. When
-/// specified, they need to be *identical* to the interface. Now that we
-/// have support for non-fragile ivars in ObjC 2.0, we can consider removing
-/// the legacy semantics and allow developers to move private ivar declarations
-/// from the class interface to the class implementation (but I digress:-)
+/// allow instance variables to be specified in the implementation. When
+/// specified, they need to be *identical* to the interface.
///
class ObjCImplementationDecl : public Decl, public DeclContext {
/// Class interface for this implementation
@@ -1031,11 +1033,12 @@ public:
classmeth_iterator classmeth_begin() const { return ClassMethods.begin(); }
classmeth_iterator classmeth_end() const { return ClassMethods.end(); }
- // Get the instance method definition for this implementation.
+ // Get the local instance/class method declared in this interface.
ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
-
- // Get the class method definition for this implementation.
ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel) : getClassMethod(Sel);
+ }
typedef ObjCIvarDecl * const *ivar_iterator;
ivar_iterator ivar_begin() const { return Ivars; }