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/AST/ASTDumperUtils.h" |
17 | #include "clang/Basic/LLVM.h" |
18 | #include <memory> |
19 | |
20 | namespace clang { |
21 | |
22 | class ASTConsumer; |
23 | |
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 | |
31 | // AST dumper: dumps the raw AST in human-readable form to the given output |
32 | // stream, or stdout if OS is nullptr. |
33 | std::unique_ptr<ASTConsumer> |
34 | CreateASTDumper(std::unique_ptr<raw_ostream> OS, StringRef FilterString, |
35 | bool DumpDecls, bool Deserialize, bool DumpLookups, |
36 | bool DumpDeclTypes, ASTDumpOutputFormat Format); |
37 | |
38 | // AST Decl node lister: prints qualified names of all filterable AST Decl |
39 | // nodes. |
40 | std::unique_ptr<ASTConsumer> CreateASTDeclNodeLister(); |
41 | |
42 | // Graphical AST viewer: for each function definition, creates a graph of |
43 | // the AST and displays it with the graph viewer "dotty". Also outputs |
44 | // function declarations to stderr. |
45 | std::unique_ptr<ASTConsumer> CreateASTViewer(); |
46 | |
47 | } // end clang namespace |
48 | |
49 | #endif |
50 | |