#ifndef ABSTRACT_DECL
#  define ABSTRACT_DECL(Type) Type
#endif
#ifndef DECL_RANGE
#  define DECL_RANGE(Base, First, Last)
#endif

#ifndef LAST_DECL_RANGE
#  define LAST_DECL_RANGE(Base, First, Last) DECL_RANGE(Base, First, Last)
#endif

#ifndef ACCESSSPEC
#  define ACCESSSPEC(Type, Base) DECL(Type, Base)
#endif
ACCESSSPEC(AccessSpec, Decl)
#undef ACCESSSPEC

#ifndef BLOCK
#  define BLOCK(Type, Base) DECL(Type, Base)
#endif
BLOCK(Block, Decl)
#undef BLOCK

#ifndef CLASSSCOPEFUNCTIONSPECIALIZATION
#  define CLASSSCOPEFUNCTIONSPECIALIZATION(Type, Base) DECL(Type, Base)
#endif
CLASSSCOPEFUNCTIONSPECIALIZATION(ClassScopeFunctionSpecialization, Decl)
#undef CLASSSCOPEFUNCTIONSPECIALIZATION

#ifndef FILESCOPEASM
#  define FILESCOPEASM(Type, Base) DECL(Type, Base)
#endif
FILESCOPEASM(FileScopeAsm, Decl)
#undef FILESCOPEASM

#ifndef FRIEND
#  define FRIEND(Type, Base) DECL(Type, Base)
#endif
FRIEND(Friend, Decl)
#undef FRIEND

#ifndef FRIENDTEMPLATE
#  define FRIENDTEMPLATE(Type, Base) DECL(Type, Base)
#endif
FRIENDTEMPLATE(FriendTemplate, Decl)
#undef FRIENDTEMPLATE

#ifndef LINKAGESPEC
#  define LINKAGESPEC(Type, Base) DECL(Type, Base)
#endif
LINKAGESPEC(LinkageSpec, Decl)
#undef LINKAGESPEC

#ifndef NAMED
#  define NAMED(Type, Base) DECL(Type, Base)
#endif
ABSTRACT_DECL(NAMED(Named, Decl))
#ifndef LABEL
#  define LABEL(Type, Base) NAMED(Type, Base)
#endif
LABEL(Label, NamedDecl)
#undef LABEL

#ifndef NAMESPACE
#  define NAMESPACE(Type, Base) NAMED(Type, Base)
#endif
NAMESPACE(Namespace, NamedDecl)
#undef NAMESPACE

#ifndef NAMESPACEALIAS
#  define NAMESPACEALIAS(Type, Base) NAMED(Type, Base)
#endif
NAMESPACEALIAS(NamespaceAlias, NamedDecl)
#undef NAMESPACEALIAS

#ifndef OBJCCOMPATIBLEALIAS
#  define OBJCCOMPATIBLEALIAS(Type, Base) NAMED(Type, Base)
#endif
OBJCCOMPATIBLEALIAS(ObjCCompatibleAlias, NamedDecl)
#undef OBJCCOMPATIBLEALIAS

#ifndef OBJCCONTAINER
#  define OBJCCONTAINER(Type, Base) NAMED(Type, Base)
#endif
ABSTRACT_DECL(OBJCCONTAINER(ObjCContainer, NamedDecl))
#ifndef OBJCCATEGORY
#  define OBJCCATEGORY(Type, Base) OBJCCONTAINER(Type, Base)
#endif
OBJCCATEGORY(ObjCCategory, ObjCContainerDecl)
#undef OBJCCATEGORY

#ifndef OBJCIMPL
#  define OBJCIMPL(Type, Base) OBJCCONTAINER(Type, Base)
#endif
ABSTRACT_DECL(OBJCIMPL(ObjCImpl, ObjCContainerDecl))
#ifndef OBJCCATEGORYIMPL
#  define OBJCCATEGORYIMPL(Type, Base) OBJCIMPL(Type, Base)
#endif
OBJCCATEGORYIMPL(ObjCCategoryImpl, ObjCImplDecl)
#undef OBJCCATEGORYIMPL

#ifndef OBJCIMPLEMENTATION
#  define OBJCIMPLEMENTATION(Type, Base) OBJCIMPL(Type, Base)
#endif
OBJCIMPLEMENTATION(ObjCImplementation, ObjCImplDecl)
#undef OBJCIMPLEMENTATION

DECL_RANGE(ObjCImpl, ObjCCategoryImpl, ObjCImplementation)

#undef OBJCIMPL

#ifndef OBJCINTERFACE
#  define OBJCINTERFACE(Type, Base) OBJCCONTAINER(Type, Base)
#endif
OBJCINTERFACE(ObjCInterface, ObjCContainerDecl)
#undef OBJCINTERFACE

#ifndef OBJCPROTOCOL
#  define OBJCPROTOCOL(Type, Base) OBJCCONTAINER(Type, Base)
#endif
OBJCPROTOCOL(ObjCProtocol, ObjCContainerDecl)
#undef OBJCPROTOCOL

DECL_RANGE(ObjCContainer, ObjCCategory, ObjCProtocol)

#undef OBJCCONTAINER

#ifndef OBJCMETHOD
#  define OBJCMETHOD(Type, Base) NAMED(Type, Base)
#endif
OBJCMETHOD(ObjCMethod, NamedDecl)
#undef OBJCMETHOD

#ifndef OBJCPROPERTY
#  define OBJCPROPERTY(Type, Base) NAMED(Type, Base)
#endif
OBJCPROPERTY(ObjCProperty, NamedDecl)
#undef OBJCPROPERTY

#ifndef TEMPLATE
#  define TEMPLATE(Type, Base) NAMED(Type, Base)
#endif
ABSTRACT_DECL(TEMPLATE(Template, NamedDecl))
#ifndef REDECLARABLETEMPLATE
#  define REDECLARABLETEMPLATE(Type, Base) TEMPLATE(Type, Base)
#endif
ABSTRACT_DECL(REDECLARABLETEMPLATE(RedeclarableTemplate, TemplateDecl))
#ifndef CLASSTEMPLATE
#  define CLASSTEMPLATE(Type, Base) REDECLARABLETEMPLATE(Type, Base)
#endif
CLASSTEMPLATE(ClassTemplate, RedeclarableTemplateDecl)
#undef CLASSTEMPLATE

#ifndef FUNCTIONTEMPLATE
#  define FUNCTIONTEMPLATE(Type, Base) REDECLARABLETEMPLATE(Type, Base)
#endif
FUNCTIONTEMPLATE(FunctionTemplate, RedeclarableTemplateDecl)
#undef FUNCTIONTEMPLATE

#ifndef TYPEALIASTEMPLATE
#  define TYPEALIASTEMPLATE(Type, Base) REDECLARABLETEMPLATE(Type, Base)
#endif
TYPEALIASTEMPLATE(TypeAliasTemplate, RedeclarableTemplateDecl)
#undef TYPEALIASTEMPLATE

DECL_RANGE(RedeclarableTemplate, ClassTemplate, TypeAliasTemplate)

#undef REDECLARABLETEMPLATE

#ifndef TEMPLATETEMPLATEPARM
#  define TEMPLATETEMPLATEPARM(Type, Base) TEMPLATE(Type, Base)
#endif
TEMPLATETEMPLATEPARM(TemplateTemplateParm, TemplateDecl)
#undef TEMPLATETEMPLATEPARM

DECL_RANGE(Template, ClassTemplate, TemplateTemplateParm)

#undef TEMPLATE

#ifndef TYPE
#  define TYPE(Type, Base) NAMED(Type, Base)
#endif
ABSTRACT_DECL(TYPE(Type, NamedDecl))
#ifndef TAG
#  define TAG(Type, Base) TYPE(Type, Base)
#endif
ABSTRACT_DECL(TAG(Tag, TypeDecl))
#ifndef ENUM
#  define ENUM(Type, Base) TAG(Type, Base)
#endif
ENUM(Enum, TagDecl)
#undef ENUM

#ifndef RECORD
#  define RECORD(Type, Base) TAG(Type, Base)
#endif
RECORD(Record, TagDecl)
#ifndef CXXRECORD
#  define CXXRECORD(Type, Base) RECORD(Type, Base)
#endif
CXXRECORD(CXXRecord, RecordDecl)
#ifndef CLASSTEMPLATESPECIALIZATION
#  define CLASSTEMPLATESPECIALIZATION(Type, Base) CXXRECORD(Type, Base)
#endif
CLASSTEMPLATESPECIALIZATION(ClassTemplateSpecialization, CXXRecordDecl)
#ifndef CLASSTEMPLATEPARTIALSPECIALIZATION
#  define CLASSTEMPLATEPARTIALSPECIALIZATION(Type, Base) CLASSTEMPLATESPECIALIZATION(Type, Base)
#endif
CLASSTEMPLATEPARTIALSPECIALIZATION(ClassTemplatePartialSpecialization, ClassTemplateSpecializationDecl)
#undef CLASSTEMPLATEPARTIALSPECIALIZATION

DECL_RANGE(ClassTemplateSpecialization, ClassTemplateSpecialization, ClassTemplatePartialSpecialization)

#undef CLASSTEMPLATESPECIALIZATION

DECL_RANGE(CXXRecord, CXXRecord, ClassTemplatePartialSpecialization)

#undef CXXRECORD

DECL_RANGE(Record, Record, ClassTemplatePartialSpecialization)

#undef RECORD

DECL_RANGE(Tag, Enum, ClassTemplatePartialSpecialization)

#undef TAG

#ifndef TEMPLATETYPEPARM
#  define TEMPLATETYPEPARM(Type, Base) TYPE(Type, Base)
#endif
TEMPLATETYPEPARM(TemplateTypeParm, TypeDecl)
#undef TEMPLATETYPEPARM

#ifndef TYPEDEFNAME
#  define TYPEDEFNAME(Type, Base) TYPE(Type, Base)
#endif
ABSTRACT_DECL(TYPEDEFNAME(TypedefName, TypeDecl))
#ifndef TYPEALIAS
#  define TYPEALIAS(Type, Base) TYPEDEFNAME(Type, Base)
#endif
TYPEALIAS(TypeAlias, TypedefNameDecl)
#undef TYPEALIAS

#ifndef TYPEDEF
#  define TYPEDEF(Type, Base) TYPEDEFNAME(Type, Base)
#endif
TYPEDEF(Typedef, TypedefNameDecl)
#undef TYPEDEF

DECL_RANGE(TypedefName, TypeAlias, Typedef)

#undef TYPEDEFNAME

#ifndef UNRESOLVEDUSINGTYPENAME
#  define UNRESOLVEDUSINGTYPENAME(Type, Base) TYPE(Type, Base)
#endif
UNRESOLVEDUSINGTYPENAME(UnresolvedUsingTypename, TypeDecl)
#undef UNRESOLVEDUSINGTYPENAME

DECL_RANGE(Type, Enum, UnresolvedUsingTypename)

#undef TYPE

#ifndef USING
#  define USING(Type, Base) NAMED(Type, Base)
#endif
USING(Using, NamedDecl)
#undef USING

#ifndef USINGDIRECTIVE
#  define USINGDIRECTIVE(Type, Base) NAMED(Type, Base)
#endif
USINGDIRECTIVE(UsingDirective, NamedDecl)
#undef USINGDIRECTIVE

#ifndef USINGSHADOW
#  define USINGSHADOW(Type, Base) NAMED(Type, Base)
#endif
USINGSHADOW(UsingShadow, NamedDecl)
#undef USINGSHADOW

#ifndef VALUE
#  define VALUE(Type, Base) NAMED(Type, Base)
#endif
ABSTRACT_DECL(VALUE(Value, NamedDecl))
#ifndef DECLARATOR
#  define DECLARATOR(Type, Base) VALUE(Type, Base)
#endif
ABSTRACT_DECL(DECLARATOR(Declarator, ValueDecl))
#ifndef FIELD
#  define FIELD(Type, Base) DECLARATOR(Type, Base)
#endif
FIELD(Field, DeclaratorDecl)
#ifndef OBJCATDEFSFIELD
#  define OBJCATDEFSFIELD(Type, Base) FIELD(Type, Base)
#endif
OBJCATDEFSFIELD(ObjCAtDefsField, FieldDecl)
#undef OBJCATDEFSFIELD

#ifndef OBJCIVAR
#  define OBJCIVAR(Type, Base) FIELD(Type, Base)
#endif
OBJCIVAR(ObjCIvar, FieldDecl)
#undef OBJCIVAR

DECL_RANGE(Field, Field, ObjCIvar)

#undef FIELD

#ifndef FUNCTION
#  define FUNCTION(Type, Base) DECLARATOR(Type, Base)
#endif
FUNCTION(Function, DeclaratorDecl)
#ifndef CXXMETHOD
#  define CXXMETHOD(Type, Base) FUNCTION(Type, Base)
#endif
CXXMETHOD(CXXMethod, FunctionDecl)
#ifndef CXXCONSTRUCTOR
#  define CXXCONSTRUCTOR(Type, Base) CXXMETHOD(Type, Base)
#endif
CXXCONSTRUCTOR(CXXConstructor, CXXMethodDecl)
#undef CXXCONSTRUCTOR

#ifndef CXXCONVERSION
#  define CXXCONVERSION(Type, Base) CXXMETHOD(Type, Base)
#endif
CXXCONVERSION(CXXConversion, CXXMethodDecl)
#undef CXXCONVERSION

#ifndef CXXDESTRUCTOR
#  define CXXDESTRUCTOR(Type, Base) CXXMETHOD(Type, Base)
#endif
CXXDESTRUCTOR(CXXDestructor, CXXMethodDecl)
#undef CXXDESTRUCTOR

DECL_RANGE(CXXMethod, CXXMethod, CXXDestructor)

#undef CXXMETHOD

DECL_RANGE(Function, Function, CXXDestructor)

#undef FUNCTION

#ifndef NONTYPETEMPLATEPARM
#  define NONTYPETEMPLATEPARM(Type, Base) DECLARATOR(Type, Base)
#endif
NONTYPETEMPLATEPARM(NonTypeTemplateParm, DeclaratorDecl)
#undef NONTYPETEMPLATEPARM

#ifndef VAR
#  define VAR(Type, Base) DECLARATOR(Type, Base)
#endif
VAR(Var, DeclaratorDecl)
#ifndef IMPLICITPARAM
#  define IMPLICITPARAM(Type, Base) VAR(Type, Base)
#endif
IMPLICITPARAM(ImplicitParam, VarDecl)
#undef IMPLICITPARAM

#ifndef PARMVAR
#  define PARMVAR(Type, Base) VAR(Type, Base)
#endif
PARMVAR(ParmVar, VarDecl)
#undef PARMVAR

DECL_RANGE(Var, Var, ParmVar)

#undef VAR

DECL_RANGE(Declarator, Field, ParmVar)

#undef DECLARATOR

#ifndef ENUMCONSTANT
#  define ENUMCONSTANT(Type, Base) VALUE(Type, Base)
#endif
ENUMCONSTANT(EnumConstant, ValueDecl)
#undef ENUMCONSTANT

#ifndef INDIRECTFIELD
#  define INDIRECTFIELD(Type, Base) VALUE(Type, Base)
#endif
INDIRECTFIELD(IndirectField, ValueDecl)
#undef INDIRECTFIELD

#ifndef UNRESOLVEDUSINGVALUE
#  define UNRESOLVEDUSINGVALUE(Type, Base) VALUE(Type, Base)
#endif
UNRESOLVEDUSINGVALUE(UnresolvedUsingValue, ValueDecl)
#undef UNRESOLVEDUSINGVALUE

DECL_RANGE(Value, Field, UnresolvedUsingValue)

#undef VALUE

DECL_RANGE(Named, Label, UnresolvedUsingValue)

#undef NAMED

#ifndef OBJCCLASS
#  define OBJCCLASS(Type, Base) DECL(Type, Base)
#endif
OBJCCLASS(ObjCClass, Decl)
#undef OBJCCLASS

#ifndef OBJCFORWARDPROTOCOL
#  define OBJCFORWARDPROTOCOL(Type, Base) DECL(Type, Base)
#endif
OBJCFORWARDPROTOCOL(ObjCForwardProtocol, Decl)
#undef OBJCFORWARDPROTOCOL

#ifndef OBJCPROPERTYIMPL
#  define OBJCPROPERTYIMPL(Type, Base) DECL(Type, Base)
#endif
OBJCPROPERTYIMPL(ObjCPropertyImpl, Decl)
#undef OBJCPROPERTYIMPL

#ifndef STATICASSERT
#  define STATICASSERT(Type, Base) DECL(Type, Base)
#endif
STATICASSERT(StaticAssert, Decl)
#undef STATICASSERT

#ifndef TRANSLATIONUNIT
#  define TRANSLATIONUNIT(Type, Base) DECL(Type, Base)
#endif
TRANSLATIONUNIT(TranslationUnit, Decl)
#undef TRANSLATIONUNIT

LAST_DECL_RANGE(Decl, AccessSpec, TranslationUnit)

#undef DECL
#undef DECL_RANGE
#undef LAST_DECL_RANGE
#undef ABSTRACT_DECL
#ifndef DECL_CONTEXT
#  define DECL_CONTEXT(DECL)
#endif
#ifndef DECL_CONTEXT_BASE
#  define DECL_CONTEXT_BASE(DECL) DECL_CONTEXT(DECL)
#endif
DECL_CONTEXT_BASE(Function)
DECL_CONTEXT_BASE(Tag)
DECL_CONTEXT_BASE(ObjCContainer)
DECL_CONTEXT(Block)
DECL_CONTEXT(LinkageSpec)
DECL_CONTEXT(Namespace)
DECL_CONTEXT(ObjCMethod)
DECL_CONTEXT(TranslationUnit)
#undef DECL_CONTEXT
#undef DECL_CONTEXT_BASE
