diff options
author | Steve Naroff <snaroff@apple.com> | 2009-01-08 20:35:58 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-01-08 20:35:58 +0000 |
commit | b718b407db1f921c5a2dc0164a23582c322f8ce0 (patch) | |
tree | 1333542d501f37ae68f6f41fba6ec8facda1fb3c | |
parent | 6804461f7f154b38130e421b16daf7f2890feb49 (diff) |
Add missing castToDeclContext/castFromDeclContext hooks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61939 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DeclObjC.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 8c5ed18f83..409bf14fd6 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -758,6 +758,12 @@ public: static bool classof(const Decl *D) { return D->getKind() == ObjCProtocol; } static bool classof(const ObjCProtocolDecl *D) { return true; } + static DeclContext *castToDeclContext(const ObjCProtocolDecl *D) { + return static_cast<DeclContext *>(const_cast<ObjCProtocolDecl*>(D)); + } + static ObjCProtocolDecl *castFromDeclContext(const DeclContext *DC) { + return static_cast<ObjCProtocolDecl *>(const_cast<DeclContext*>(DC)); + } }; /// ObjCClassDecl - Specifies a list of forward class declarations. For example: @@ -947,6 +953,12 @@ public: static bool classof(const Decl *D) { return D->getKind() == ObjCCategory; } static bool classof(const ObjCCategoryDecl *D) { return true; } + static DeclContext *castToDeclContext(const ObjCCategoryDecl *D) { + return static_cast<DeclContext *>(const_cast<ObjCCategoryDecl*>(D)); + } + static ObjCCategoryDecl *castFromDeclContext(const DeclContext *DC) { + return static_cast<ObjCCategoryDecl *>(const_cast<DeclContext*>(DC)); + } }; /// ObjCCategoryImplDecl - An object of this class encapsulates a category @@ -1041,6 +1053,12 @@ 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<DeclContext *>(const_cast<ObjCCategoryImplDecl*>(D)); + } + static ObjCCategoryImplDecl *castFromDeclContext(const DeclContext *DC) { + return static_cast<ObjCCategoryImplDecl *>(const_cast<DeclContext*>(DC)); + } }; /// ObjCImplementationDecl - Represents a class definition - this is where @@ -1163,6 +1181,12 @@ public: return D->getKind() == ObjCImplementation; } static bool classof(const ObjCImplementationDecl *D) { return true; } + static DeclContext *castToDeclContext(const ObjCImplementationDecl *D) { + return static_cast<DeclContext *>(const_cast<ObjCImplementationDecl*>(D)); + } + static ObjCImplementationDecl *castFromDeclContext(const DeclContext *DC) { + return static_cast<ObjCImplementationDecl *>(const_cast<DeclContext*>(DC)); + } }; /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is |