[cfe-commits] r62027 - /cfe/trunk/include/clang/AST/DeclCXX.h
Zhongxing Xu
xuzhongxing at gmail.com
Sat Jan 10 06:38:46 PST 2009
Author: zhongxingxu
Date: Sat Jan 10 08:38:38 2009
New Revision: 62027
URL: http://llvm.org/viewvc/llvm-project?rev=62027&view=rev
Log:
add a bunch of castToDeclContext/castFromDeclContext methods.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=62027&r1=62026&r2=62027&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Sat Jan 10 08:38:38 2009
@@ -489,6 +489,12 @@
return D->getKind() >= CXXMethod && D->getKind() <= CXXConversion;
}
static bool classof(const CXXMethodDecl *D) { return true; }
+ static DeclContext *castToDeclContext(const CXXMethodDecl *D) {
+ return static_cast<DeclContext *>(const_cast<CXXMethodDecl*>(D));
+ }
+ static CXXMethodDecl *castFromDeclContext(const DeclContext *DC) {
+ return static_cast<CXXMethodDecl *>(const_cast<DeclContext*>(DC));
+ }
protected:
/// EmitImpl - Serialize this CXXMethodDecl. Called by Decl::Emit.
@@ -697,7 +703,12 @@
return D->getKind() == CXXConstructor;
}
static bool classof(const CXXConstructorDecl *D) { return true; }
-
+ static DeclContext *castToDeclContext(const CXXConstructorDecl *D) {
+ return static_cast<DeclContext *>(const_cast<CXXConstructorDecl*>(D));
+ }
+ static CXXConstructorDecl *castFromDeclContext(const DeclContext *DC) {
+ return static_cast<CXXConstructorDecl *>(const_cast<DeclContext*>(DC));
+ }
/// EmitImpl - Serialize this CXXConstructorDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
@@ -763,7 +774,12 @@
return D->getKind() == CXXDestructor;
}
static bool classof(const CXXDestructorDecl *D) { return true; }
-
+ static DeclContext *castToDeclContext(const CXXDestructorDecl *D) {
+ return static_cast<DeclContext *>(const_cast<CXXDestructorDecl*>(D));
+ }
+ static CXXDestructorDecl *castFromDeclContext(const DeclContext *DC) {
+ return static_cast<CXXDestructorDecl *>(const_cast<DeclContext*>(DC));
+ }
/// EmitImpl - Serialize this CXXDestructorDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
@@ -817,7 +833,12 @@
return D->getKind() == CXXConversion;
}
static bool classof(const CXXConversionDecl *D) { return true; }
-
+ static DeclContext *castToDeclContext(const CXXConversionDecl *D) {
+ return static_cast<DeclContext *>(const_cast<CXXConversionDecl*>(D));
+ }
+ static CXXConversionDecl *castFromDeclContext(const DeclContext *DC) {
+ return static_cast<CXXConversionDecl *>(const_cast<DeclContext*>(DC));
+ }
/// EmitImpl - Serialize this CXXConversionDecl. Called by Decl::Emit.
// FIXME: Implement this.
//virtual void EmitImpl(llvm::Serializer& S) const;
More information about the cfe-commits
mailing list