clangのDeclVisitorが呼んでくれる関数のリストがお手軽にほしかったので調べてみました。
以下のコマンドで出力することができます。
# DeclVisitor.hのマクロを参考にいたしました。
1 2 3 4 5 |
$ clang++ --version clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1) Target: i686-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin |
1 2 3 4 5 6 |
$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" |
1 |
$ cat Macro | clang++ -E - -I/usr/lib/llvm-4.0/include | egrep "^[^#$]" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
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オプションで与えれば戻り値を変更できます。
1 |
$ cat Macro | clang++ -E - -I/usr/lib/llvm-4.0/include -DRetTy=bool | egrep "^[^#$]" |
1 2 3 4 |
virtual bool VisitAccessSpecDecl(const AccessSpecDecl * const D) {} virtual bool VisitBlockDecl(const BlockDecl * const D) {} virtual bool VisitCapturedDecl(const CapturedDecl * const D) {} : |