From: Argyrios Kyrtzidis Date: Fri, 17 Jul 2009 01:19:49 +0000 (+0000) Subject: ObjCCategoryImplDecl and ObjCImplementation do not derive directly from DeclContext... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfb498d0996ef049efe9476f2802976fd145cd60;p=clang ObjCCategoryImplDecl and ObjCImplementation do not derive directly from DeclContext but from a new abstract ObjCImplDecl. Reflect this change on the "DeclContext hierarchy". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76137 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 019a0fe965..2d056c479b 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -37,6 +37,7 @@ class ObjCCategoryDecl; class ObjCProtocolDecl; class ObjCImplementationDecl; class ObjCCategoryImplDecl; +class ObjCImplDecl; class LinkageSpecDecl; class BlockDecl; class DeclarationName; @@ -393,8 +394,7 @@ public: /// TagDecl /// ObjCMethodDecl /// ObjCContainerDecl -/// ObjCCategoryImplDecl -/// ObjCImplementationDecl +/// ObjCImpl /// LinkageSpecDecl /// BlockDecl /// diff --git a/include/clang/AST/DeclNodes.def b/include/clang/AST/DeclNodes.def index 1e4440357b..fd89d8845d 100644 --- a/include/clang/AST/DeclNodes.def +++ b/include/clang/AST/DeclNodes.def @@ -132,8 +132,7 @@ DECL_CONTEXT(TranslationUnit) DECL_CONTEXT(Namespace) DECL_CONTEXT(LinkageSpec) DECL_CONTEXT(ObjCMethod) -DECL_CONTEXT(ObjCCategoryImpl) -DECL_CONTEXT(ObjCImplementation) +DECL_CONTEXT_BASE(ObjCImpl) DECL_CONTEXT_BASE(Tag) DECL_CONTEXT_BASE(Function) DECL_CONTEXT_BASE(ObjCContainer) diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 2fcdaa3e29..c6b7910c7d 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -883,6 +883,17 @@ public: SourceLocation getLocStart() const { return getLocation(); } SourceLocation getLocEnd() const { return EndLoc; } void setLocEnd(SourceLocation LE) { EndLoc = LE; }; + + static bool classof(const Decl *D) { + return D->getKind() >= ObjCImplFirst && D->getKind() <= ObjCImplLast; + } + static bool classof(const ObjCImplDecl *D) { return true; } + static DeclContext *castToDeclContext(const ObjCImplDecl *D) { + return static_cast(const_cast(D)); + } + static ObjCImplDecl *castFromDeclContext(const DeclContext *DC) { + return static_cast(const_cast(DC)); + } }; /// ObjCCategoryImplDecl - An object of this class encapsulates a category @@ -931,12 +942,6 @@ public: static bool classof(const Decl *D) { return D->getKind() == ObjCCategoryImpl;} static bool classof(const ObjCCategoryImplDecl *D) { return true; } - static DeclContext *castToDeclContext(const ObjCCategoryImplDecl *D) { - return static_cast(const_cast(D)); - } - static ObjCCategoryImplDecl *castFromDeclContext(const DeclContext *DC) { - return static_cast(const_cast(DC)); - } }; /// ObjCImplementationDecl - Represents a class definition - this is where @@ -1010,12 +1015,6 @@ public: return D->getKind() == ObjCImplementation; } static bool classof(const ObjCImplementationDecl *D) { return true; } - static DeclContext *castToDeclContext(const ObjCImplementationDecl *D) { - return static_cast(const_cast(D)); - } - static ObjCImplementationDecl *castFromDeclContext(const DeclContext *DC) { - return static_cast(const_cast(DC)); - } }; /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is