Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

DeclVisitorが呼んでくれる関数のリスト

More than 3 years have passed since last update.

clangのDeclVisitorが呼んでくれる関数のリストがお手軽にほしかったので調べてみました。
以下のコマンドで出力することができます。
 # DeclVisitor.hのマクロを参考にいたしました。

$ clang++ --version
clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
Target: i686-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$cat Macro
#ifndef RetTy
#define RetTy void
#endif
#define DECL(DERIVED, BASE) virtual RetTy Visit##DERIVED##Decl(const DERIVED##Decl * const D) {}
#include "clang/AST/DeclNodes.inc"

$ cat Macro | clang++ -E - -I/usr/lib/llvm-4.0/include | egrep "^[^#$]"

virtual void VisitAccessSpecDecl(const AccessSpecDecl * const D) {}
virtual void VisitBlockDecl(const BlockDecl * const D) {}
virtual void VisitCapturedDecl(const CapturedDecl * const D) {}
virtual void VisitClassScopeFunctionSpecializationDecl(const ClassScopeFunctionSpecializationDecl * const D) {}
virtual void VisitEmptyDecl(const EmptyDecl * const D) {}
virtual void VisitExportDecl(const ExportDecl * const D) {}
virtual void VisitExternCContextDecl(const ExternCContextDecl * const D) {}
virtual void VisitFileScopeAsmDecl(const FileScopeAsmDecl * const D) {}
virtual void VisitFriendDecl(const FriendDecl * const D) {}
virtual void VisitFriendTemplateDecl(const FriendTemplateDecl * const D) {}
virtual void VisitImportDecl(const ImportDecl * const D) {}
virtual void VisitLinkageSpecDecl(const LinkageSpecDecl * const D) {}
virtual void VisitNamedDecl(const NamedDecl * const D) {}
virtual void VisitLabelDecl(const LabelDecl * const D) {}
virtual void VisitNamespaceDecl(const NamespaceDecl * const D) {}
virtual void VisitNamespaceAliasDecl(const NamespaceAliasDecl * const D) {}
virtual void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl * const D) {}
virtual void VisitObjCContainerDecl(const ObjCContainerDecl * const D) {}
virtual void VisitObjCCategoryDecl(const ObjCCategoryDecl * const D) {}
virtual void VisitObjCImplDecl(const ObjCImplDecl * const D) {}
virtual void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl * const D) {}
virtual void VisitObjCImplementationDecl(const ObjCImplementationDecl * const D) {}
virtual void VisitObjCInterfaceDecl(const ObjCInterfaceDecl * const D) {}
virtual void VisitObjCProtocolDecl(const ObjCProtocolDecl * const D) {}
virtual void VisitObjCMethodDecl(const ObjCMethodDecl * const D) {}
virtual void VisitObjCPropertyDecl(const ObjCPropertyDecl * const D) {}
virtual void VisitTemplateDecl(const TemplateDecl * const D) {}
virtual void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl * const D) {}
virtual void VisitRedeclarableTemplateDecl(const RedeclarableTemplateDecl * const D) {}
virtual void VisitClassTemplateDecl(const ClassTemplateDecl * const D) {}
virtual void VisitFunctionTemplateDecl(const FunctionTemplateDecl * const D) {}
virtual void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl * const D) {}
virtual void VisitVarTemplateDecl(const VarTemplateDecl * const D) {}
virtual void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl * const D) {}
virtual void VisitTypeDecl(const TypeDecl * const D) {}
virtual void VisitTagDecl(const TagDecl * const D) {}
virtual void VisitEnumDecl(const EnumDecl * const D) {}
virtual void VisitRecordDecl(const RecordDecl * const D) {}
virtual void VisitCXXRecordDecl(const CXXRecordDecl * const D) {}
virtual void VisitClassTemplateSpecializationDecl(const ClassTemplateSpecializationDecl * const D) {}
virtual void VisitClassTemplatePartialSpecializationDecl(const ClassTemplatePartialSpecializationDecl * const D) {}
virtual void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl * const D) {}
virtual void VisitTypedefNameDecl(const TypedefNameDecl * const D) {}
virtual void VisitObjCTypeParamDecl(const ObjCTypeParamDecl * const D) {}
virtual void VisitTypeAliasDecl(const TypeAliasDecl * const D) {}
virtual void VisitTypedefDecl(const TypedefDecl * const D) {}
virtual void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl * const D) {}
virtual void VisitUsingDecl(const UsingDecl * const D) {}
virtual void VisitUsingDirectiveDecl(const UsingDirectiveDecl * const D) {}
virtual void VisitUsingPackDecl(const UsingPackDecl * const D) {}
virtual void VisitUsingShadowDecl(const UsingShadowDecl * const D) {}
virtual void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl * const D) {}
virtual void VisitValueDecl(const ValueDecl * const D) {}
virtual void VisitBindingDecl(const BindingDecl * const D) {}
virtual void VisitDeclaratorDecl(const DeclaratorDecl * const D) {}
virtual void VisitFieldDecl(const FieldDecl * const D) {}
virtual void VisitObjCAtDefsFieldDecl(const ObjCAtDefsFieldDecl * const D) {}
virtual void VisitObjCIvarDecl(const ObjCIvarDecl * const D) {}
virtual void VisitFunctionDecl(const FunctionDecl * const D) {}
virtual void VisitCXXMethodDecl(const CXXMethodDecl * const D) {}
virtual void VisitCXXConstructorDecl(const CXXConstructorDecl * const D) {}
virtual void VisitCXXConversionDecl(const CXXConversionDecl * const D) {}
virtual void VisitCXXDestructorDecl(const CXXDestructorDecl * const D) {}
virtual void VisitMSPropertyDecl(const MSPropertyDecl * const D) {}
virtual void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl * const D) {}
virtual void VisitVarDecl(const VarDecl * const D) {}
virtual void VisitDecompositionDecl(const DecompositionDecl * const D) {}
virtual void VisitImplicitParamDecl(const ImplicitParamDecl * const D) {}
virtual void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl * const D) {}
virtual void VisitParmVarDecl(const ParmVarDecl * const D) {}
virtual void VisitVarTemplateSpecializationDecl(const VarTemplateSpecializationDecl * const D) {}
virtual void VisitVarTemplatePartialSpecializationDecl(const VarTemplatePartialSpecializationDecl * const D) {}
virtual void VisitEnumConstantDecl(const EnumConstantDecl * const D) {}
virtual void VisitIndirectFieldDecl(const IndirectFieldDecl * const D) {}
virtual void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl * const D) {}
virtual void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl * const D) {}
virtual void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl * const D) {}
virtual void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl * const D) {}
virtual void VisitPragmaCommentDecl(const PragmaCommentDecl * const D) {}
virtual void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl * const D) {}
virtual void VisitStaticAssertDecl(const StaticAssertDecl * const D) {}
virtual void VisitTranslationUnitDecl(const TranslationUnitDecl * const D) {}

RetTy定義を-Dオプションで与えれば戻り値を変更できます。
$ cat Macro | clang++ -E - -I/usr/lib/llvm-4.0/include -DRetTy=bool | egrep "^[^#$]"

virtual bool VisitAccessSpecDecl(const AccessSpecDecl * const D) {}
virtual bool VisitBlockDecl(const BlockDecl * const D) {}
virtual bool VisitCapturedDecl(const CapturedDecl * const D) {}
 :
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away