[cfe-commits] r62026 - /cfe/trunk/include/clang/AST/Decl.h

Zhongxing Xu xuzhongxing at gmail.com
Sat Jan 10 06:14:17 PST 2009


Author: zhongxingxu
Date: Sat Jan 10 08:14:16 2009
New Revision: 62026

URL: http://llvm.org/viewvc/llvm-project?rev=62026&view=rev
Log:
add castToDeclContext/castFromDeclContext methods to RecordDecl.

Modified:
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=62026&r1=62025&r2=62026&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sat Jan 10 08:14:16 2009
@@ -1146,7 +1146,12 @@
     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;





More information about the cfe-commits mailing list