aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-01-10 14:14:16 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-01-10 14:14:16 +0000
commite58336400c9bea6daa4e4038ec71a61bf430dd0b (patch)
tree37f2ac1aea8f3fe9c162d0459d3fd68c046a9626
parent4312472607d3f4010ad6e82aaa56a424eccee682 (diff)
add castToDeclContext/castFromDeclContext methods to RecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62026 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Decl.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index e0b0b169a2..673669209c 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -1146,7 +1146,12 @@ public:
return D->getKind() >= RecordFirst && D->getKind() <= RecordLast;
}
static bool classof(const RecordDecl *D) { return true; }
-
+ static DeclContext *castToDeclContext(const RecordDecl *D) {
+ return static_cast<DeclContext *>(const_cast<RecordDecl*>(D));
+ }
+ static RecordDecl *castFromDeclContext(const DeclContext *DC) {
+ return static_cast<RecordDecl *>(const_cast<DeclContext*>(DC));
+ }
protected:
/// EmitImpl - Serialize this RecordDecl. Called by Decl::Emit.
virtual void EmitImpl(llvm::Serializer& S) const;