[cfe-commits] r105165 - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/Visitors/ lib/AST/ lib/Analysis/ lib/Checker/ lib/CodeGen/ lib/Frontend/ lib/Sema/

Sean Hunt rideau3 at gmail.com
Sun May 30 00:21:58 PDT 2010


Author: coppro
Date: Sun May 30 02:21:58 2010
New Revision: 105165

URL: http://llvm.org/viewvc/llvm-project?rev=105165&view=rev
Log:
Convert DeclNodes to use TableGen.

The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.

Added:
    cfe/trunk/include/clang/AST/DeclNodes.td
Removed:
    cfe/trunk/include/clang/AST/DeclNodes.def
Modified:
    cfe/trunk/include/clang/AST/CMakeLists.txt
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/include/clang/AST/DeclTemplate.h
    cfe/trunk/include/clang/AST/DeclVisitor.h
    cfe/trunk/include/clang/AST/Makefile
    cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
    cfe/trunk/lib/AST/CMakeLists.txt
    cfe/trunk/lib/AST/DeclBase.cpp
    cfe/trunk/lib/Analysis/CMakeLists.txt
    cfe/trunk/lib/Checker/CMakeLists.txt
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CMakeLists.txt
    cfe/trunk/lib/Frontend/CMakeLists.txt
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
    cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
    cfe/trunk/lib/Sema/CMakeLists.txt
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/include/clang/AST/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/AST/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -3,3 +3,9 @@
          -gen-clang-stmt-nodes)
 add_custom_target(ClangStmtNodes
   DEPENDS StmtNodes.inc)
+
+set(LLVM_TARGET_DEFINITIONS DeclNodes.td)
+tablegen(DeclNodes.inc
+         -gen-clang-decl-nodes)
+add_custom_target(ClangDeclNodes
+  DEPENDS DeclNodes.inc)

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun May 30 02:21:58 2010
@@ -216,7 +216,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const NamedDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= NamedFirst && K <= NamedLast; }
+  static bool classofKind(Kind K) { return K >= firstNamed && K <= lastNamed; }
 };
 
 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
@@ -361,7 +361,7 @@
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const ValueDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= ValueFirst && K <= ValueLast; }
+  static bool classofKind(Kind K) { return K >= firstValue && K <= lastValue; }
 };
 
 /// \brief Represents a ValueDecl that came out of a declarator.
@@ -417,7 +417,7 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const DeclaratorDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= DeclaratorFirst && K <= DeclaratorLast;
+    return K >= firstDeclarator && K <= lastDeclarator;
   }
 };
 
@@ -908,7 +908,7 @@
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const VarDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= VarFirst && K <= VarLast; }
+  static bool classofKind(Kind K) { return K >= firstVar && K <= lastVar; }
 };
 
 class ImplicitParamDecl : public VarDecl {
@@ -1493,7 +1493,7 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const FunctionDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= FunctionFirst && K <= FunctionLast;
+    return K >= firstFunction && K <= lastFunction;
   }
   static DeclContext *castToDeclContext(const FunctionDecl *D) {
     return static_cast<DeclContext *>(const_cast<FunctionDecl*>(D));
@@ -1556,7 +1556,7 @@
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const FieldDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= FieldFirst && K <= FieldLast; }
+  static bool classofKind(Kind K) { return K >= firstField && K <= lastField; }
 };
 
 /// EnumConstantDecl - An instance of this object exists for each enum constant
@@ -1625,7 +1625,7 @@
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const TypeDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= TypeFirst && K <= TypeLast; }
+  static bool classofKind(Kind K) { return K >= firstType && K <= lastType; }
 };
 
 
@@ -1847,7 +1847,7 @@
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const TagDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K >= TagFirst && K <= TagLast; }
+  static bool classofKind(Kind K) { return K >= firstTag && K <= lastTag; }
 
   static DeclContext *castToDeclContext(const TagDecl *D) {
     return static_cast<DeclContext *>(const_cast<TagDecl*>(D));
@@ -2092,7 +2092,7 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const RecordDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= RecordFirst && K <= RecordLast;
+    return K >= firstRecord && K <= lastRecord;
   }
 };
 

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sun May 30 02:21:58 2010
@@ -68,12 +68,13 @@
 public:
   /// \brief Lists the kind of concrete classes of Decl.
   enum Kind {
-#define DECL(Derived, Base) Derived,
-#define DECL_RANGE(CommonBase, Start, End) \
-    CommonBase##First = Start, CommonBase##Last = End,
-#define LAST_DECL_RANGE(CommonBase, Start, End) \
-    CommonBase##First = Start, CommonBase##Last = End
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) DERIVED,
+#define ABSTRACT_DECL(DECL)
+#define DECL_RANGE(BASE, START, END) \
+        first##BASE = START, last##BASE = END,
+#define LAST_DECL_RANGE(BASE, START, END) \
+        first##BASE = START, last##BASE = END
+#include "clang/AST/DeclNodes.inc"
   };
 
   /// \brief A placeholder type used to construct an empty shell of a
@@ -244,7 +245,7 @@
       HasAttrs(false), Implicit(false), Used(false),
       Access(AS_none), PCHLevel(0),
       IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
-    if (Decl::CollectingStats()) addDeclKind(DK);
+    if (Decl::CollectingStats()) add(DK);
   }
 
   virtual ~Decl();
@@ -482,7 +483,7 @@
   SourceLocation getBodyRBrace() const;
 
   // global temp stats (until we have a per-module visitor)
-  static void addDeclKind(Kind k);
+  static void add(Kind k);
   static bool CollectingStats(bool Enable = false);
   static void PrintStats();
 
@@ -687,7 +688,7 @@
     case Decl::ObjCMethod:
       return true;
     default:
-      return DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast;
+      return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
     }
   }
 
@@ -700,7 +701,7 @@
   }
 
   bool isRecord() const {
-    return DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast;
+    return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
   }
 
   bool isNamespace() const {
@@ -1083,9 +1084,10 @@
 
   static bool classof(const Decl *D);
   static bool classof(const DeclContext *D) { return true; }
-#define DECL_CONTEXT(Name) \
-  static bool classof(const Name##Decl *D) { return true; }
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT(NAME) \
+  static bool classof(const NAME##Decl *D) { return true; }
+#include "clang/AST/DeclNodes.inc"
 
   void dumpDeclContext() const;
 

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Sun May 30 02:21:58 2010
@@ -920,9 +920,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) {
-    return K == CXXRecord ||
-           K == ClassTemplateSpecialization ||
-           K == ClassTemplatePartialSpecialization;
+    return K >= firstCXXRecord && K <= lastCXXRecord;
   }
   static bool classof(const CXXRecordDecl *D) { return true; }
   static bool classof(const ClassTemplateSpecializationDecl *D) {
@@ -1012,7 +1010,7 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const CXXMethodDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= CXXMethod && K <= CXXConversion;
+    return K >= firstCXXMethod && K <= lastCXXMethod;
   }
 };
 
@@ -1607,7 +1605,7 @@
                      SourceLocation IdentLoc,
                      NamedDecl *Nominated,
                      DeclContext *CommonAncestor)
-    : NamedDecl(Decl::UsingDirective, DC, L, getName()),
+    : NamedDecl(UsingDirective, DC, L, getName()),
       NamespaceLoc(NamespcLoc), QualifierRange(QualifierRange),
       Qualifier(Qualifier), IdentLoc(IdentLoc),
       NominatedNamespace(Nominated),
@@ -1680,7 +1678,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const UsingDirectiveDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::UsingDirective; }
+  static bool classofKind(Kind K) { return K == UsingDirective; }
 
   // Friend for getUsingDirectiveName.
   friend class DeclContext;
@@ -1714,7 +1712,7 @@
                      SourceRange QualifierRange,
                      NestedNameSpecifier *Qualifier,
                      SourceLocation IdentLoc, NamedDecl *Namespace)
-    : NamedDecl(Decl::NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
+    : NamedDecl(NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
       QualifierRange(QualifierRange), Qualifier(Qualifier),
       IdentLoc(IdentLoc), Namespace(Namespace) { }
 
@@ -1786,7 +1784,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const NamespaceAliasDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::NamespaceAlias; }
+  static bool classofKind(Kind K) { return K == NamespaceAlias; }
 };
 
 /// UsingShadowDecl - Represents a shadow declaration introduced into
@@ -1866,7 +1864,7 @@
   UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR,
             SourceLocation UL, NestedNameSpecifier* TargetNNS,
             DeclarationName Name, bool IsTypeNameArg)
-    : NamedDecl(Decl::Using, DC, L, Name),
+    : NamedDecl(Using, DC, L, Name),
       NestedNameRange(NNR), UsingLocation(UL), TargetNestedName(TargetNNS),
       IsTypeName(IsTypeNameArg) {
   }
@@ -1934,7 +1932,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const UsingDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::Using; }
+  static bool classofKind(Kind K) { return K == Using; }
 };
 
 /// UnresolvedUsingValueDecl - Represents a dependent using
@@ -1960,7 +1958,7 @@
                            NestedNameSpecifier *TargetNNS,
                            SourceLocation TargetNameLoc,
                            DeclarationName TargetName)
-    : ValueDecl(Decl::UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
+    : ValueDecl(UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
     TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
     TargetNestedNameSpecifier(TargetNNS)
   { }
@@ -1997,7 +1995,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const UnresolvedUsingValueDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingValue; }
+  static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
 };
 
 /// UnresolvedUsingTypenameDecl - Represents a dependent using
@@ -2026,7 +2024,7 @@
                     SourceLocation TypenameLoc,
                     SourceRange TargetNNR, NestedNameSpecifier *TargetNNS,
                     SourceLocation TargetNameLoc, IdentifierInfo *TargetName)
-  : TypeDecl(Decl::UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
+  : TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
     TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
     TypenameLocation(TypenameLoc), TargetNestedNameSpecifier(TargetNNS)
   { }
@@ -2070,7 +2068,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const UnresolvedUsingTypenameDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingTypename; }
+  static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; }
 };
 
 /// StaticAssertDecl - Represents a C++0x static_assert declaration.
@@ -2098,7 +2096,7 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(StaticAssertDecl *D) { return true; }
-  static bool classofKind(Kind K) { return K == Decl::StaticAssert; }
+  static bool classofKind(Kind K) { return K == StaticAssert; }
 };
 
 /// Insertion operator for diagnostics.  This allows sending AccessSpecifier's

Removed: cfe/trunk/include/clang/AST/DeclNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclNodes.def?rev=105164&view=auto
==============================================================================
--- cfe/trunk/include/clang/AST/DeclNodes.def (original)
+++ cfe/trunk/include/clang/AST/DeclNodes.def (removed)
@@ -1,165 +0,0 @@
-//===-- DeclNodes.def - Metadata about Decl AST nodes -----------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defines the declaration nodes within the AST. The
-//  description of the declaration nodes uses six macros: 
-//
-//  DECL(Derived, Base) describes a normal declaration type Derived
-//  and specifies its base class. Note that Derived should not have
-//  the Decl suffix on it, while Base should.
-//
-//  LAST_DECL(Derived, Base) is like DECL, but is used for the last
-//  declaration in the list.
-//
-//  ABSTRACT_DECL(Derived, Base) describes an abstract class that is
-//  used to specify a classification of declarations. For example,
-//  TagDecl is an abstract class used to describe the various kinds of
-//  "tag" declarations (unions, structs, classes, enums).
-//
-//  DECL_CONTEXT(Decl) specifies that Decl is a kind of declaration
-//  that is also a DeclContext.
-//  
-//  LAST_DECL_CONTEXT(Decl) is like DECL_CONTEXT, but is used for the
-//  last declaration context.
-//
-//  DECL_RANGE(CommonBase, Start, End) specifies a range of
-//  declaration values that have a common (potentially indirect) base
-//  class.
-//
-//  LAST_DECL_RANGE(CommonBase, Start, End) is like DECL_RANGE, but is
-//  used for the last declaration range.
-//
-//  Note that, due to the use of ranges, the order of the these
-//  declarations is significant. A declaration should be listed under
-//  its base class.
-//  ===----------------------------------------------------------------------===//
-
-#ifndef DECL
-#  define DECL(Derived, Base)
-#endif
-
-#ifndef LAST_DECL
-#  define LAST_DECL(Derived, Base) DECL(Derived, Base)
-#endif
-
-#ifndef ABSTRACT_DECL
-#  define ABSTRACT_DECL(Derived, Base)
-#endif
-
-#ifndef DECL_CONTEXT
-#  define DECL_CONTEXT(Decl)
-#endif
-
-#ifndef DECL_CONTEXT_BASE
-#  define DECL_CONTEXT_BASE(Decl) DECL_CONTEXT(Decl)
-#endif
-
-#ifndef LAST_DECL_CONTEXT
-#  define LAST_DECL_CONTEXT(Decl) DECL_CONTEXT(Decl)
-#endif
-
-#ifndef DECL_RANGE
-#  define DECL_RANGE(CommonBase, Start, End)
-#endif
-
-#ifndef LAST_DECL_RANGE
-#  define LAST_DECL_RANGE(CommonBase, Start, End) \
-  DECL_RANGE(CommonBase, Start, End)
-#endif
-
-DECL(TranslationUnit, Decl)
-ABSTRACT_DECL(Named,  Decl)
-  DECL(Namespace, NamedDecl)
-  DECL(UsingDirective, NamedDecl)
-  DECL(NamespaceAlias, NamedDecl)
-  ABSTRACT_DECL(Type, NamedDecl)
-    DECL(Typedef, TypeDecl)
-    DECL(UnresolvedUsingTypename, TypeDecl)
-    ABSTRACT_DECL(Tag, TypeDecl)
-      DECL(Enum, TagDecl)
-      DECL(Record, TagDecl)
-        DECL(CXXRecord, RecordDecl)
-          DECL(ClassTemplateSpecialization, CXXRecordDecl)
-            DECL(ClassTemplatePartialSpecialization, 
-                 ClassTemplateSpecializationDecl)
-    DECL(TemplateTypeParm, TypeDecl)
-  ABSTRACT_DECL(Value, NamedDecl)
-    DECL(EnumConstant, ValueDecl)
-    DECL(UnresolvedUsingValue, ValueDecl)
-    ABSTRACT_DECL(Declarator, ValueDecl)
-      DECL(Function, DeclaratorDecl)
-        DECL(CXXMethod, FunctionDecl)
-          DECL(CXXConstructor, CXXMethodDecl)
-          DECL(CXXDestructor, CXXMethodDecl)
-          DECL(CXXConversion, CXXMethodDecl)
-      DECL(Field, DeclaratorDecl)
-        DECL(ObjCIvar, FieldDecl)
-        DECL(ObjCAtDefsField, FieldDecl)
-      DECL(Var, DeclaratorDecl)
-        DECL(ImplicitParam, VarDecl)
-        DECL(ParmVar, VarDecl)
-        DECL(NonTypeTemplateParm, VarDecl)
-  ABSTRACT_DECL(Template, NamedDecl)
-    DECL(FunctionTemplate, TemplateDecl)
-    DECL(ClassTemplate, TemplateDecl)
-    DECL(TemplateTemplateParm, TemplateDecl)
-  DECL(Using, NamedDecl)
-  DECL(UsingShadow, NamedDecl)
-  DECL(ObjCMethod, NamedDecl)
-  ABSTRACT_DECL(ObjCContainer, NamedDecl)
-    DECL(ObjCCategory, ObjCContainerDecl)
-    DECL(ObjCProtocol, ObjCContainerDecl)
-    DECL(ObjCInterface, ObjCContainerDecl)
-    ABSTRACT_DECL(ObjCImpl, ObjCContainerDecl)
-      DECL(ObjCCategoryImpl, ObjCImplDecl)
-      DECL(ObjCImplementation, ObjCImplDecl)
-  DECL(ObjCProperty, NamedDecl)
-  DECL(ObjCCompatibleAlias, NamedDecl)
-DECL(LinkageSpec, Decl)
-DECL(ObjCPropertyImpl, Decl)
-DECL(ObjCForwardProtocol, Decl)
-DECL(ObjCClass, Decl)
-DECL(FileScopeAsm, Decl)
-DECL(Friend, Decl)
-DECL(FriendTemplate, Decl)
-DECL(StaticAssert, Decl)
-LAST_DECL(Block, Decl)
-
-// Declaration contexts. DECL_CONTEXT_BASE indicates that it has subclasses.
-DECL_CONTEXT(TranslationUnit)
-DECL_CONTEXT(Namespace)
-DECL_CONTEXT(LinkageSpec)
-DECL_CONTEXT(ObjCMethod)
-DECL_CONTEXT_BASE(Tag)
-DECL_CONTEXT_BASE(Function)
-DECL_CONTEXT_BASE(ObjCContainer)
-LAST_DECL_CONTEXT(Block)
-
-// Declaration ranges
-DECL_RANGE(Named, Namespace, ObjCCompatibleAlias)
-DECL_RANGE(ObjCContainer, ObjCCategory, ObjCImplementation)
-DECL_RANGE(Field, Field, ObjCAtDefsField)
-DECL_RANGE(Type, Typedef, TemplateTypeParm)
-DECL_RANGE(Tag, Enum, ClassTemplatePartialSpecialization)
-DECL_RANGE(Record, Record, ClassTemplatePartialSpecialization)
-DECL_RANGE(Value, EnumConstant, NonTypeTemplateParm)
-DECL_RANGE(Declarator, Function, NonTypeTemplateParm)
-DECL_RANGE(Function, Function, CXXConversion)
-DECL_RANGE(Template, FunctionTemplate, TemplateTemplateParm)
-DECL_RANGE(ObjCImpl, ObjCCategoryImpl, ObjCImplementation)
-LAST_DECL_RANGE(Var, Var, NonTypeTemplateParm)
-
-#undef LAST_DECL_RANGE
-#undef DECL_RANGE
-#undef LAST_DECL_CONTEXT
-#undef DECL_CONTEXT_BASE
-#undef DECL_CONTEXT
-#undef ABSTRACT_DECL
-#undef LAST_DECL
-#undef DECL

Added: cfe/trunk/include/clang/AST/DeclNodes.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclNodes.td?rev=105165&view=auto
==============================================================================
--- cfe/trunk/include/clang/AST/DeclNodes.td (added)
+++ cfe/trunk/include/clang/AST/DeclNodes.td Sun May 30 02:21:58 2010
@@ -0,0 +1,67 @@
+class Decl<bit abstract = 0> {
+  bit Abstract = abstract;
+}
+
+class DDecl<Decl base, bit abstract = 0> : Decl<abstract> {
+  Decl Base = base;
+}
+
+class DeclContext { }
+
+def TranslationUnit : Decl, DeclContext;
+def Named : Decl<1>;
+  def Namespace : DDecl<Named>, DeclContext;
+  def UsingDirective : DDecl<Named>;
+  def NamespaceAlias : DDecl<Named>;
+  def Type : DDecl<Named, 1>;
+    def Typedef : DDecl<Type>;
+    def UnresolvedUsingTypename : DDecl<Type>;
+    def Tag : DDecl<Type, 1>, DeclContext;
+      def Enum : DDecl<Tag>;
+      def Record : DDecl<Tag>;
+        def CXXRecord : DDecl<Record>;
+          def ClassTemplateSpecialization : DDecl<CXXRecord>;
+            def ClassTemplatePartialSpecialization
+              : DDecl<ClassTemplateSpecialization>;
+    def TemplateTypeParm : DDecl<Type>;
+  def Value : DDecl<Named, 1>;
+    def EnumConstant : DDecl<Value>;
+    def UnresolvedUsingValue : DDecl<Value>;
+    def Declarator : DDecl<Value, 1>;
+      def Function : DDecl<Declarator>, DeclContext;
+        def CXXMethod : DDecl<Function>;
+          def CXXConstructor : DDecl<CXXMethod>;
+          def CXXDestructor : DDecl<CXXMethod>;
+          def CXXConversion : DDecl<CXXMethod>;
+      def Field : DDecl<Declarator>;
+        def ObjCIvar : DDecl<Field>;
+        def ObjCAtDefsField : DDecl<Field>;
+      def Var : DDecl<Declarator>;
+        def ImplicitParam : DDecl<Var>;
+        def ParmVar : DDecl<Var>;
+        def NonTypeTemplateParm : DDecl<Var>;
+  def Template : DDecl<Named, 1>;
+    def FunctionTemplate : DDecl<Template>;
+    def ClassTemplate : DDecl<Template>;
+    def TemplateTemplateParm : DDecl<Template>;
+  def Using : DDecl<Named>;
+  def UsingShadow : DDecl<Named>;
+  def ObjCMethod : DDecl<Named>, DeclContext;
+  def ObjCContainer : DDecl<Named, 1>, DeclContext;
+    def ObjCCategory : DDecl<ObjCContainer>;
+    def ObjCProtocol : DDecl<ObjCContainer>;
+    def ObjCInterface : DDecl<ObjCContainer>;
+    def ObjCImpl : DDecl<ObjCContainer, 1>;
+      def ObjCCategoryImpl : DDecl<ObjCImpl>;
+      def ObjCImplementation : DDecl<ObjCImpl>;
+  def ObjCProperty : DDecl<Named>;
+  def ObjCCompatibleAlias : DDecl<Named>;
+def LinkageSpec : Decl, DeclContext;
+def ObjCPropertyImpl : Decl;
+def ObjCForwardProtocol : Decl;
+def ObjCClass : Decl;
+def FileScopeAsm : Decl;
+def Friend : Decl;
+def FriendTemplate : Decl;
+def StaticAssert : Decl;
+def Block : Decl, DeclContext;

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sun May 30 02:21:58 2010
@@ -417,8 +417,8 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const ObjCContainerDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= ObjCContainerFirst &&
-           K <= ObjCContainerLast;
+    return K >= firstObjCContainer &&
+           K <= lastObjCContainer;
   }
 
   static DeclContext *castToDeclContext(const ObjCContainerDecl *D) {
@@ -1059,7 +1059,7 @@
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const ObjCImplDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= ObjCImplFirst && K <= ObjCImplLast;
+    return K >= firstObjCImpl && K <= lastObjCImpl;
   }
 };
 

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Sun May 30 02:21:58 2010
@@ -261,7 +261,7 @@
   static bool classof(const ClassTemplateDecl *D) { return true; }
   static bool classof(const TemplateTemplateParmDecl *D) { return true; }
   static bool classofKind(Kind K) {
-    return K >= TemplateFirst && K <= TemplateLast;
+    return K >= firstTemplate && K <= lastTemplate;
   }
 
 protected:
@@ -1001,8 +1001,8 @@
 
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) {
-    return K == ClassTemplateSpecialization ||
-           K == ClassTemplatePartialSpecialization;
+    return K >= firstClassTemplateSpecialization &&
+           K <= lastClassTemplateSpecialization;
   }
 
   static bool classof(const ClassTemplateSpecializationDecl *) {

Modified: cfe/trunk/include/clang/AST/DeclVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclVisitor.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DeclVisitor.h Sun May 30 02:21:58 2010
@@ -30,20 +30,19 @@
 public:
   RetTy Visit(Decl *D) {
     switch (D->getKind()) {
-      default: assert(false && "Decl that isn't part of DeclNodes.def!");
-#define DECL(Derived, Base) \
-      case Decl::Derived: DISPATCH(Derived##Decl, Derived##Decl);
-#define ABSTRACT_DECL(Derived, Base)
-#include "clang/AST/DeclNodes.def"
+      default: assert(false && "Decl that isn't part of DeclNodes.inc!");
+#define DECL(DERIVED, BASE) \
+      case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl);
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
     }
   }
 
   // If the implementation chooses not to implement a certain visit
   // method, fall back to the parent.
-#define DECL(Derived, Base)                                             \
-  RetTy Visit##Derived##Decl(Derived##Decl *D) { DISPATCH(Base, Base); }
-#define ABSTRACT_DECL(Derived, Base) DECL(Derived, Base)
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) \
+  RetTy Visit##DERIVED##Decl(DERIVED##Decl *D) { DISPATCH(BASE, BASE); }
+#include "clang/AST/DeclNodes.inc"
 
   RetTy VisitDecl(Decl *D) { return RetTy(); }
 };

Modified: cfe/trunk/include/clang/AST/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Makefile?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Makefile (original)
+++ cfe/trunk/include/clang/AST/Makefile Sun May 30 02:21:58 2010
@@ -1,13 +1,16 @@
 LEVEL = ../../../../..
-BUILT_SOURCES = StmtNodes.inc
+BUILT_SOURCES = StmtNodes.inc DeclNodes.inc
 
 TABLEGEN_INC_FILES_COMMON = 1
 
 include $(LEVEL)/Makefile.common
 
-INPUT_TDS = $(PROJ_SRC_DIR)/StmtNodes.td
+INPUT_TDS = $(PROJ_SRC_DIR)/StmtNodes.td $(PROJ_SRC_DIR)/DeclNodes.td
 
 $(ObjDir)/StmtNodes.inc.tmp : StmtNodes.td $(TBLGEN) $(ObjDir)/.dir
 	$(Echo) "Building Clang statement node tables with tblgen"
 	$(Verb) $(TableGen) -gen-clang-stmt-nodes -o $(call SYSPATH, $@) $<
 
+$(ObjDir)/DeclNodes.inc.tmp : DeclNodes.td $(TBLGEN) $(ObjDir)/.dir
+	$(Echo) "Building Clang declaration node tables with tblgen"
+	$(Verb) $(TableGen) -gen-clang-decl-nodes -o $(call SYSPATH, $@) $<

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Sun May 30 02:21:58 2010
@@ -178,12 +178,12 @@
   /// the inheritance chain until reaching VisitDecl().
   bool VisitDecl(Decl *D);
 
-#define DECL(Class, Base)                        \
-  bool Visit##Class##Decl(Class##Decl *D) {      \
-    return getDerived().Visit##Base(D);          \
+#define DECL(CLASS, BASE)                   \
+  bool Visit##CLASS##Decl(CLASS##Decl *D) { \
+    return getDerived().Visit##BASE(D);     \
   }
-#define ABSTRACT_DECL(Class, Base) DECL(Class, Base)
-#include "clang/AST/DeclNodes.def"
+#include "clang/AST/DeclNodes.inc"
+
 };
 
 template<typename Derived>
@@ -257,15 +257,15 @@
     case UnaryOperator::Imag:      DISPATCH(UnaryImag,      UnaryOperator, S);
     case UnaryOperator::Extension: DISPATCH(UnaryExtension, UnaryOperator, S);
     case UnaryOperator::OffsetOf:  DISPATCH(UnaryOffsetOf,  UnaryOperator, S);
-    }
+   }
   }
 
   // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
   switch (S->getStmtClass()) {
   case Stmt::NoStmtClass: break;
 #define ABSTRACT_STMT(STMT)
-#define STMT(CLASS, PARENT)                              \
-case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS, S);
+#define STMT(CLASS, PARENT) \
+  case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS, S);
 #include "clang/AST/StmtNodes.inc"
   }
 
@@ -293,11 +293,11 @@
     return false;
 
   switch (D->getKind()) {
-#define ABSTRACT_DECL(Class, Base)
-#define DECL(Class, Base) \
-  case Decl::Class: DISPATCH(Class##Decl, Class##Decl, D);
-#include "clang/AST/DeclNodes.def"
-  }
+#define ABSTRACT_DECL(DECL)
+#define DECL(CLASS, BASE) \
+    case Decl::CLASS: DISPATCH(CLASS##Decl, CLASS##Decl, D);
+#include "clang/AST/DeclNodes.inc"
+ }
 
   return false;
 }

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sun May 30 02:21:58 2010
@@ -99,11 +99,9 @@
     NoStmtClass = 0,
 #define STMT(CLASS, PARENT) CLASS##Class,
 #define STMT_RANGE(BASE, FIRST, LAST) \
-        first##BASE##Constant = FIRST##Class, \
-        last##BASE##Constant = LAST##Class,
+        first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
-        first##BASE##Constant = FIRST##Class, \
-        last##BASE##Constant = LAST##Class
+        first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
 #define ABSTRACT_STMT(STMT)
 #include "clang/AST/StmtNodes.inc"
 };

Modified: cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h Sun May 30 02:21:58 2010
@@ -22,13 +22,14 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclCXX.h"
 
-#define DISPATCH_CASE(CASE,CLASS) \
-case Decl::CASE: \
-static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<CLASS*>(D));\
+#define DISPATCH_CASE(CLASS)                                  \
+case Decl::CLASS:                                             \
+static_cast<ImplClass*>(this)->Visit##CLASS##Decl(            \
+                               static_cast<CLASS##Decl*>(D)); \
 break;
 
-#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS(CLASS* D) {}
-#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS(CLASS* D)\
+#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D) {}
+#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D)\
   { static_cast<ImplClass*>(this)->VisitVarDecl(D); }
 
 
@@ -55,34 +56,34 @@
 
   void VisitDecl(Decl* D) {
     switch (D->getKind()) {
-        DISPATCH_CASE(Function,FunctionDecl)
-        DISPATCH_CASE(CXXMethod,CXXMethodDecl)
-        DISPATCH_CASE(Var,VarDecl)
-        DISPATCH_CASE(ParmVar,ParmVarDecl)       // FIXME: (same)
-        DISPATCH_CASE(ImplicitParam,ImplicitParamDecl)
-        DISPATCH_CASE(EnumConstant,EnumConstantDecl)
-        DISPATCH_CASE(Typedef,TypedefDecl)
-        DISPATCH_CASE(Record,RecordDecl)    // FIXME: Refine.  VisitStructDecl?
-        DISPATCH_CASE(Enum,EnumDecl)
+        DISPATCH_CASE(Function)
+        DISPATCH_CASE(CXXMethod)
+        DISPATCH_CASE(Var)
+        DISPATCH_CASE(ParmVar)       // FIXME: (same)
+        DISPATCH_CASE(ImplicitParam)
+        DISPATCH_CASE(EnumConstant)
+        DISPATCH_CASE(Typedef)
+        DISPATCH_CASE(Record)    // FIXME: Refine.  VisitStructDecl?
+        DISPATCH_CASE(Enum)
       default:
         assert(false && "Subtype of ScopedDecl not handled.");
     }
   }
 
-  DEFAULT_DISPATCH(VarDecl)
-  DEFAULT_DISPATCH(FunctionDecl)
-  DEFAULT_DISPATCH(CXXMethodDecl)
-  DEFAULT_DISPATCH_VARDECL(ParmVarDecl)
-  DEFAULT_DISPATCH(ImplicitParamDecl)
-  DEFAULT_DISPATCH(EnumConstantDecl)
-  DEFAULT_DISPATCH(TypedefDecl)
-  DEFAULT_DISPATCH(RecordDecl)
-  DEFAULT_DISPATCH(EnumDecl)
-  DEFAULT_DISPATCH(ObjCInterfaceDecl)
-  DEFAULT_DISPATCH(ObjCClassDecl)
-  DEFAULT_DISPATCH(ObjCMethodDecl)
-  DEFAULT_DISPATCH(ObjCProtocolDecl)
-  DEFAULT_DISPATCH(ObjCCategoryDecl)
+  DEFAULT_DISPATCH(Var)
+  DEFAULT_DISPATCH(Function)
+  DEFAULT_DISPATCH(CXXMethod)
+  DEFAULT_DISPATCH_VARDECL(ParmVar)
+  DEFAULT_DISPATCH(ImplicitParam)
+  DEFAULT_DISPATCH(EnumConstant)
+  DEFAULT_DISPATCH(Typedef)
+  DEFAULT_DISPATCH(Record)
+  DEFAULT_DISPATCH(Enum)
+  DEFAULT_DISPATCH(ObjCInterface)
+  DEFAULT_DISPATCH(ObjCClass)
+  DEFAULT_DISPATCH(ObjCMethod)
+  DEFAULT_DISPATCH(ObjCProtocol)
+  DEFAULT_DISPATCH(ObjCCategory)
 };
 
 } // end namespace clang

Modified: cfe/trunk/lib/AST/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CMakeLists.txt (original)
+++ cfe/trunk/lib/AST/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -39,4 +39,4 @@
   TypePrinter.cpp
   )
 
-add_dependencies(clangAST ClangDiagnosticAST ClangStmtNodes)
+add_dependencies(clangAST ClangDiagnosticAST ClangDeclNodes ClangStmtNodes)

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Sun May 30 02:21:58 2010
@@ -35,16 +35,18 @@
 //  Statistics
 //===----------------------------------------------------------------------===//
 
-#define DECL(Derived, Base) static int n##Derived##s = 0;
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) static int n##DERIVED##s = 0;
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
 
 static bool StatSwitch = false;
 
 const char *Decl::getDeclKindName() const {
   switch (DeclKind) {
-  default: assert(0 && "Declaration not in DeclNodes.def!");
-#define DECL(Derived, Base) case Derived: return #Derived;
-#include "clang/AST/DeclNodes.def"
+  default: assert(0 && "Declaration not in DeclNodes.inc!");
+#define DECL(DERIVED, BASE) case DERIVED: return #DERIVED;
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
   }
 }
 
@@ -60,9 +62,10 @@
 
 const char *DeclContext::getDeclKindName() const {
   switch (DeclKind) {
-  default: assert(0 && "Declaration context not in DeclNodes.def!");
-#define DECL(Derived, Base) case Decl::Derived: return #Derived;
-#include "clang/AST/DeclNodes.def"
+  default: assert(0 && "Declaration context not in DeclNodes.inc!");
+#define DECL(DERIVED, BASE) case Decl::DERIVED: return #DERIVED;
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
   }
 }
 
@@ -75,28 +78,31 @@
   fprintf(stderr, "*** Decl Stats:\n");
 
   int totalDecls = 0;
-#define DECL(Derived, Base) totalDecls += n##Derived##s;
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) totalDecls += n##DERIVED##s;
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
   fprintf(stderr, "  %d decls total.\n", totalDecls);
 
   int totalBytes = 0;
-#define DECL(Derived, Base)                                             \
-  if (n##Derived##s > 0) {                                              \
-    totalBytes += (int)(n##Derived##s * sizeof(Derived##Decl));         \
-    fprintf(stderr, "    %d " #Derived " decls, %d each (%d bytes)\n",  \
-            n##Derived##s, (int)sizeof(Derived##Decl),                  \
-            (int)(n##Derived##s * sizeof(Derived##Decl)));              \
+#define DECL(DERIVED, BASE)                                             \
+  if (n##DERIVED##s > 0) {                                              \
+    totalBytes += (int)(n##DERIVED##s * sizeof(DERIVED##Decl));         \
+    fprintf(stderr, "    %d " #DERIVED " decls, %d each (%d bytes)\n",  \
+            n##DERIVED##s, (int)sizeof(DERIVED##Decl),                  \
+            (int)(n##DERIVED##s * sizeof(DERIVED##Decl)));              \
   }
-#include "clang/AST/DeclNodes.def"
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
 
   fprintf(stderr, "Total bytes = %d\n", totalBytes);
 }
 
-void Decl::addDeclKind(Kind k) {
+void Decl::add(Kind k) {
   switch (k) {
-  default: assert(0 && "Declaration not in DeclNodes.def!");
-#define DECL(Derived, Base) case Derived: ++n##Derived##s; break;
-#include "clang/AST/DeclNodes.def"
+  default: assert(0 && "Declaration not in DeclNodes.inc!");
+#define DECL(DERIVED, BASE) case DERIVED: ++n##DERIVED##s; break;
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
   }
 }
 
@@ -392,16 +398,18 @@
 Decl *Decl::castFromDeclContext (const DeclContext *D) {
   Decl::Kind DK = D->getDeclKind();
   switch(DK) {
-#define DECL_CONTEXT(Name) \
-    case Decl::Name:     \
-      return static_cast<Name##Decl*>(const_cast<DeclContext*>(D));
-#define DECL_CONTEXT_BASE(Name)
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT(NAME) \
+    case Decl::NAME:       \
+      return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
+#define DECL_CONTEXT_BASE(NAME)
+#include "clang/AST/DeclNodes.inc"
     default:
-#define DECL_CONTEXT_BASE(Name)                                   \
-      if (DK >= Decl::Name##First && DK <= Decl::Name##Last)    \
-        return static_cast<Name##Decl*>(const_cast<DeclContext*>(D));
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT_BASE(NAME)                  \
+      if (DK >= first##NAME && DK <= last##NAME) \
+        return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
+#include "clang/AST/DeclNodes.inc"
       assert(false && "a decl that inherits DeclContext isn't handled");
       return 0;
   }
@@ -410,16 +418,18 @@
 DeclContext *Decl::castToDeclContext(const Decl *D) {
   Decl::Kind DK = D->getKind();
   switch(DK) {
-#define DECL_CONTEXT(Name) \
-    case Decl::Name:     \
-      return static_cast<Name##Decl*>(const_cast<Decl*>(D));
-#define DECL_CONTEXT_BASE(Name)
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT(NAME) \
+    case Decl::NAME:       \
+      return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
+#define DECL_CONTEXT_BASE(NAME)
+#include "clang/AST/DeclNodes.inc"
     default:
-#define DECL_CONTEXT_BASE(Name)                                   \
-      if (DK >= Decl::Name##First && DK <= Decl::Name##Last)    \
-        return static_cast<Name##Decl*>(const_cast<Decl*>(D));
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT_BASE(NAME)                                   \
+      if (DK >= first##NAME && DK <= last##NAME)                  \
+        return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
+#include "clang/AST/DeclNodes.inc"
       assert(false && "a decl that inherits DeclContext isn't handled");
       return 0;
   }
@@ -466,16 +476,18 @@
 
 bool DeclContext::classof(const Decl *D) {
   switch (D->getKind()) {
-#define DECL_CONTEXT(Name) case Decl::Name:
-#define DECL_CONTEXT_BASE(Name)
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT(NAME) case Decl::NAME:
+#define DECL_CONTEXT_BASE(NAME)
+#include "clang/AST/DeclNodes.inc"
       return true;
     default:
-#define DECL_CONTEXT_BASE(Name)                   \
-      if (D->getKind() >= Decl::Name##First &&  \
-          D->getKind() <= Decl::Name##Last)     \
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT_BASE(NAME)                 \
+      if (D->getKind() >= Decl::first##NAME &&  \
+          D->getKind() <= Decl::last##NAME)     \
         return true;
-#include "clang/AST/DeclNodes.def"
+#include "clang/AST/DeclNodes.inc"
       return false;
   }
 }
@@ -537,7 +549,7 @@
     return true; // FIXME: Check for C++0x scoped enums
   else if (DeclKind == Decl::LinkageSpec)
     return true;
-  else if (DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast)
+  else if (DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord)
     return cast<RecordDecl>(this)->isAnonymousStructOrUnion();
   else if (DeclKind == Decl::Namespace)
     return false; // FIXME: Check for C++0x inline namespaces
@@ -581,7 +593,7 @@
     return this;
 
   default:
-    if (DeclKind >= Decl::TagFirst && DeclKind <= Decl::TagLast) {
+    if (DeclKind >= Decl::firstTag && DeclKind <= Decl::lastTag) {
       // If this is a tag type that has a definition or is currently
       // being defined, that definition is our primary context.
       TagDecl *Tag = cast<TagDecl>(this);
@@ -602,7 +614,7 @@
       return Tag;
     }
 
-    assert(DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast &&
+    assert(DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction &&
           "Unknown DeclContext kind");
     return this;
   }

Modified: cfe/trunk/lib/Analysis/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CMakeLists.txt (original)
+++ cfe/trunk/lib/Analysis/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -9,4 +9,4 @@
   UninitializedValues.cpp
   )
 
-add_dependencies(clangAnalysis ClangDiagnosticAnalysis ClangStmtNodes)
+add_dependencies(clangAnalysis ClangDiagnosticAnalysis ClangDeclNodes ClangStmtNodes)

Modified: cfe/trunk/lib/Checker/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CMakeLists.txt (original)
+++ cfe/trunk/lib/Checker/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -71,4 +71,4 @@
   VLASizeChecker.cpp
   )
 
-add_dependencies(clangChecker ClangStmtNodes)
+add_dependencies(clangChecker ClangDeclNodes ClangStmtNodes)

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sun May 30 02:21:58 2010
@@ -38,7 +38,7 @@
   case Decl::ClassTemplatePartialSpecialization:
   case Decl::TemplateTypeParm:
   case Decl::UnresolvedUsingValue:
-    case Decl::NonTypeTemplateParm:
+  case Decl::NonTypeTemplateParm:
   case Decl::CXXMethod:
   case Decl::CXXConstructor:
   case Decl::CXXDestructor:

Modified: cfe/trunk/lib/CodeGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CMakeLists.txt (original)
+++ cfe/trunk/lib/CodeGen/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -34,4 +34,4 @@
   TargetInfo.cpp
   )
 
-add_dependencies(clangCodeGen ClangStmtNodes)
+add_dependencies(clangCodeGen ClangDeclNodes ClangStmtNodes)

Modified: cfe/trunk/lib/Frontend/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CMakeLists.txt (original)
+++ cfe/trunk/lib/Frontend/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -56,4 +56,5 @@
   ClangDiagnosticFrontend 
   ClangDiagnosticLex
   ClangDiagnosticSema
+  ClangDeclNodes
   ClangStmtNodes)

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Sun May 30 02:21:58 2010
@@ -84,7 +84,7 @@
 
     std::pair<uint64_t, uint64_t> VisitDeclContext(DeclContext *DC);
 
-    // FIXME: Reorder according to DeclNodes.def?
+    // FIXME: Reorder according to DeclNodes.td?
     void VisitObjCMethodDecl(ObjCMethodDecl *D);
     void VisitObjCContainerDecl(ObjCContainerDecl *D);
     void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);

Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Sun May 30 02:21:58 2010
@@ -89,7 +89,7 @@
                           uint64_t VisibleOffset);
 
 
-    // FIXME: Put in the same order is DeclNodes.def?
+    // FIXME: Put in the same order is DeclNodes.td?
     void VisitObjCMethodDecl(ObjCMethodDecl *D);
     void VisitObjCContainerDecl(ObjCContainerDecl *D);
     void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);

Modified: cfe/trunk/lib/Sema/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CMakeLists.txt?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CMakeLists.txt (original)
+++ cfe/trunk/lib/Sema/CMakeLists.txt Sun May 30 02:21:58 2010
@@ -34,4 +34,4 @@
   TargetAttributesSema.cpp
   )
 
-add_dependencies(clangSema ClangDiagnosticSema ClangStmtNodes)
+add_dependencies(clangSema ClangDiagnosticSema ClangDeclNodes ClangStmtNodes)

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=105165&r1=105164&r2=105165&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun May 30 02:21:58 2010
@@ -42,7 +42,7 @@
 
     // FIXME: Once we get closer to completion, replace these manually-written
     // declarations with automatically-generated ones from
-    // clang/AST/DeclNodes.def.
+    // clang/AST/DeclNodes.inc.
     Decl *VisitTranslationUnitDecl(TranslationUnitDecl *D);
     Decl *VisitNamespaceDecl(NamespaceDecl *D);
     Decl *VisitNamespaceAliasDecl(NamespaceAliasDecl *D);





More information about the cfe-commits mailing list