]> granicus.if.org Git - clang/commitdiff
add castToDeclContext/castFromDeclContext methods to RecordDecl.
authorZhongxing Xu <xuzhongxing@gmail.com>
Sat, 10 Jan 2009 14:14:16 +0000 (14:14 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Sat, 10 Jan 2009 14:14:16 +0000 (14:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62026 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h

index e0b0b169a2ac743e56bf34ec6e36724c495e4914..673669209c3c9f7fcc5c274933996fb2a74e2dec 100644 (file)
@@ -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;