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