Clang Project

clang_source_code/include/clang/Frontend/ASTConsumers.h
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
19namespace clang {
20
21class ASTConsumer;
22class CodeGenOptions;
23class DiagnosticsEngine;
24class FileManager;
25class LangOptions;
26class Preprocessor;
27class 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.
33std::unique_ptr<ASTConsumerCreateASTPrinter(std::unique_ptr<raw_ostreamOS,
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.
38std::unique_ptr<ASTConsumerCreateASTDumper(std::unique_ptr<raw_ostreamOS,
39                                             StringRef FilterString,
40                                             bool DumpDeclsbool Deserialize,
41                                             bool DumpLookups);
42
43// AST Decl node lister: prints qualified names of all filterable AST Decl
44// nodes.
45std::unique_ptr<ASTConsumerCreateASTDeclNodeLister();
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.
50std::unique_ptr<ASTConsumerCreateASTViewer();
51
52// end clang namespace
53
54#endif
55