[cfe-commits] r64632 - in /cfe/trunk/include/clang/AST: Decl.h DeclCXX.h DeclObjC.h

Argiris Kirtzidis akyrtzi at gmail.com
Mon Feb 16 06:31:00 PST 2009


Author: akirtzidis
Date: Mon Feb 16 08:31:00 2009
New Revision: 64632

URL: http://llvm.org/viewvc/llvm-project?rev=64632&view=rev
Log:
castToDeclContext/castFromDeclContext are only required to be included in the class of decls that directly derive from DeclContext.
Their subclasses don't need them.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Feb 16 08:31:00 2009
@@ -954,12 +954,6 @@
     
   static bool classof(const Decl *D) { return D->getKind() == Enum; }
   static bool classof(const EnumDecl *D) { return true; }
-  static DeclContext *castToDeclContext(const EnumDecl *D) {
-    return static_cast<DeclContext *>(const_cast<EnumDecl*>(D));
-  }
-  static EnumDecl *castFromDeclContext(const DeclContext *DC) {
-    return static_cast<EnumDecl *>(const_cast<DeclContext*>(DC));
-  }
   
 protected:
   /// EmitImpl - Serialize this EnumDecl.  Called by Decl::Emit.
@@ -1054,12 +1048,6 @@
     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;

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Mon Feb 16 08:31:00 2009
@@ -357,12 +357,6 @@
 
   static bool classof(const Decl *D) { return D->getKind() == CXXRecord; }
   static bool classof(const CXXRecordDecl *D) { return true; }
-  static DeclContext *castToDeclContext(const CXXRecordDecl *D) {
-    return static_cast<DeclContext *>(const_cast<CXXRecordDecl*>(D));
-  }
-  static CXXRecordDecl *castFromDeclContext(const DeclContext *DC) {
-    return static_cast<CXXRecordDecl *>(const_cast<DeclContext*>(DC));
-  }
 
 protected:
   /// EmitImpl - Serialize this CXXRecordDecl.  Called by Decl::Emit.
@@ -425,12 +419,6 @@
     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.
@@ -638,12 +626,6 @@
     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;
@@ -708,12 +690,6 @@
     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;
@@ -766,12 +742,6 @@
     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;
@@ -878,6 +848,12 @@
     return D->getKind() == LinkageSpec;
   }
   static bool classof(const LinkageSpecDecl *D) { return true; }
+  static DeclContext *castToDeclContext(const LinkageSpecDecl *D) {
+    return static_cast<DeclContext *>(const_cast<LinkageSpecDecl*>(D));
+  }
+  static LinkageSpecDecl *castFromDeclContext(const DeclContext *DC) {
+    return static_cast<LinkageSpecDecl *>(const_cast<DeclContext*>(DC));
+  }
   
 protected:
   void EmitInRec(llvm::Serializer& S) const;

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Feb 16 08:31:00 2009
@@ -478,12 +478,6 @@
   
   static bool classof(const Decl *D) { return D->getKind() == ObjCInterface; }
   static bool classof(const ObjCInterfaceDecl *D) { return true; }
-  static DeclContext *castToDeclContext(const ObjCInterfaceDecl *D) {
-    return static_cast<DeclContext *>(const_cast<ObjCInterfaceDecl*>(D));
-  }
-  static ObjCInterfaceDecl *castFromDeclContext(const DeclContext *DC) {
-    return static_cast<ObjCInterfaceDecl *>(const_cast<DeclContext*>(DC));
-  }
 };
 
 /// ObjCIvarDecl - Represents an ObjC instance variable. In general, ObjC
@@ -633,12 +627,6 @@
   
   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:
@@ -816,12 +804,6 @@
   
   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 





More information about the cfe-commits mailing list