Home | History | Annotate | Line # | Download | only in AST
      1 //===--- ASTDumper.h - Dumping implementation for ASTs --------------------===//
      2 //
      3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      4 // See https://llvm.org/LICENSE.txt for license information.
      5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      6 //
      7 //===----------------------------------------------------------------------===//
      8 
      9 #ifndef LLVM_CLANG_AST_ASTDUMPER_H
     10 #define LLVM_CLANG_AST_ASTDUMPER_H
     11 
     12 #include "clang/AST/ASTNodeTraverser.h"
     13 #include "clang/AST/TextNodeDumper.h"
     14 #include "clang/Basic/SourceManager.h"
     15 
     16 namespace clang {
     17 
     18 class ASTDumper : public ASTNodeTraverser<ASTDumper, TextNodeDumper> {
     19 
     20   TextNodeDumper NodeDumper;
     21 
     22   raw_ostream &OS;
     23 
     24   const bool ShowColors;
     25 
     26 public:
     27   ASTDumper(raw_ostream &OS, const ASTContext &Context, bool ShowColors)
     28       : NodeDumper(OS, Context, ShowColors), OS(OS), ShowColors(ShowColors) {}
     29 
     30   ASTDumper(raw_ostream &OS, bool ShowColors)
     31       : NodeDumper(OS, ShowColors), OS(OS), ShowColors(ShowColors) {}
     32 
     33   TextNodeDumper &doGetNodeDelegate() { return NodeDumper; }
     34 
     35   void dumpLookups(const DeclContext *DC, bool DumpDecls);
     36 
     37   template <typename SpecializationDecl>
     38   void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
     39                                       bool DumpExplicitInst, bool DumpRefOnly);
     40   template <typename TemplateDecl>
     41   void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
     42 
     43   void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
     44   void VisitClassTemplateDecl(const ClassTemplateDecl *D);
     45   void VisitVarTemplateDecl(const VarTemplateDecl *D);
     46 };
     47 
     48 } // namespace clang
     49 
     50 #endif
     51