ASTConsumers.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===//
  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. //
  14. // AST Consumers.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CLANG_FRONTEND_ASTCONSUMERS_H
  18. #define LLVM_CLANG_FRONTEND_ASTCONSUMERS_H
  19. #include "clang/AST/ASTDumperUtils.h"
  20. #include "clang/Basic/LLVM.h"
  21. #include <memory>
  22. namespace clang {
  23. class ASTConsumer;
  24. // AST pretty-printer: prints out the AST in a format that is close to the
  25. // original C code. The output is intended to be in a format such that
  26. // clang could re-parse the output back into the same AST, but the
  27. // implementation is still incomplete.
  28. std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS,
  29. StringRef FilterString);
  30. // AST dumper: dumps the raw AST in human-readable form to the given output
  31. // stream, or stdout if OS is nullptr.
  32. std::unique_ptr<ASTConsumer>
  33. CreateASTDumper(std::unique_ptr<raw_ostream> OS, StringRef FilterString,
  34. bool DumpDecls, bool Deserialize, bool DumpLookups,
  35. bool DumpDeclTypes, ASTDumpOutputFormat Format);
  36. // AST Decl node lister: prints qualified names of all filterable AST Decl
  37. // nodes.
  38. std::unique_ptr<ASTConsumer> CreateASTDeclNodeLister();
  39. // Graphical AST viewer: for each function definition, creates a graph of
  40. // the AST and displays it with the graph viewer "dotty". Also outputs
  41. // function declarations to stderr.
  42. std::unique_ptr<ASTConsumer> CreateASTViewer();
  43. } // end clang namespace
  44. #endif
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif