[cfe-commits] r76137 - in /cfe/trunk/include/clang/AST: DeclBase.h DeclNodes.def DeclObjC.h

Argiris Kirtzidis akyrtzi at gmail.com
Thu Jul 16 18:19:50 PDT 2009


Author: akirtzidis
Date: Thu Jul 16 20:19:49 2009
New Revision: 76137

URL: http://llvm.org/viewvc/llvm-project?rev=76137&view=rev
Log:
ObjCCategoryImplDecl and ObjCImplementation do not derive directly from DeclContext but from a new abstract ObjCImplDecl.
Reflect this change on the "DeclContext hierarchy".

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/include/clang/AST/DeclNodes.def
    cfe/trunk/include/clang/AST/DeclObjC.h

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu Jul 16 20:19:49 2009
@@ -37,6 +37,7 @@
 class ObjCProtocolDecl;
 class ObjCImplementationDecl;
 class ObjCCategoryImplDecl;
+class ObjCImplDecl;
 class LinkageSpecDecl;
 class BlockDecl;
 class DeclarationName;
@@ -393,8 +394,7 @@
 ///   TagDecl
 ///   ObjCMethodDecl
 ///   ObjCContainerDecl
-///   ObjCCategoryImplDecl
-///   ObjCImplementationDecl
+///   ObjCImpl
 ///   LinkageSpecDecl
 ///   BlockDecl
 ///

Modified: cfe/trunk/include/clang/AST/DeclNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclNodes.def?rev=76137&r1=76136&r2=76137&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclNodes.def (original)
+++ cfe/trunk/include/clang/AST/DeclNodes.def Thu Jul 16 20:19:49 2009
@@ -132,8 +132,7 @@
 DECL_CONTEXT(Namespace)
 DECL_CONTEXT(LinkageSpec)
 DECL_CONTEXT(ObjCMethod)
-DECL_CONTEXT(ObjCCategoryImpl)
-DECL_CONTEXT(ObjCImplementation)
+DECL_CONTEXT_BASE(ObjCImpl)
 DECL_CONTEXT_BASE(Tag)
 DECL_CONTEXT_BASE(Function)
 DECL_CONTEXT_BASE(ObjCContainer)

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Jul 16 20:19:49 2009
@@ -883,6 +883,17 @@
   SourceLocation getLocStart() const { return getLocation(); }
   SourceLocation getLocEnd() const { return EndLoc; }
   void setLocEnd(SourceLocation LE) { EndLoc = LE; };
+
+  static bool classof(const Decl *D) {
+    return D->getKind() >= ObjCImplFirst && D->getKind() <= ObjCImplLast;
+  }
+  static bool classof(const ObjCImplDecl *D) { return true; }
+  static DeclContext *castToDeclContext(const ObjCImplDecl *D) {
+    return static_cast<DeclContext *>(const_cast<ObjCImplDecl*>(D));
+  }
+  static ObjCImplDecl *castFromDeclContext(const DeclContext *DC) {
+    return static_cast<ObjCImplDecl *>(const_cast<DeclContext*>(DC));
+  }
 };
   
 /// ObjCCategoryImplDecl - An object of this class encapsulates a category 
@@ -931,12 +942,6 @@
   
   static bool classof(const Decl *D) { return D->getKind() == ObjCCategoryImpl;}
   static bool classof(const ObjCCategoryImplDecl *D) { return true; }
-  static DeclContext *castToDeclContext(const ObjCCategoryImplDecl *D) {
-    return static_cast<DeclContext *>(const_cast<ObjCCategoryImplDecl*>(D));
-  }
-  static ObjCCategoryImplDecl *castFromDeclContext(const DeclContext *DC) {
-    return static_cast<ObjCCategoryImplDecl *>(const_cast<DeclContext*>(DC));
-  }
 };
 
 /// ObjCImplementationDecl - Represents a class definition - this is where
@@ -1010,12 +1015,6 @@
     return D->getKind() == ObjCImplementation;
   }
   static bool classof(const ObjCImplementationDecl *D) { return true; }
-  static DeclContext *castToDeclContext(const ObjCImplementationDecl *D) {
-    return static_cast<DeclContext *>(const_cast<ObjCImplementationDecl*>(D));
-  }
-  static ObjCImplementationDecl *castFromDeclContext(const DeclContext *DC) {
-    return static_cast<ObjCImplementationDecl *>(const_cast<DeclContext*>(DC));
-  }
 };
 
 /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is 





More information about the cfe-commits mailing list