ASTDumper.h 1.8 KB

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