diff options
Diffstat (limited to 'include/clang/Frontend/ASTConsumers.h')
-rw-r--r-- | include/clang/Frontend/ASTConsumers.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h new file mode 100644 index 0000000..04365d7 --- /dev/null +++ b/include/clang/Frontend/ASTConsumers.h @@ -0,0 +1,107 @@ +//===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// AST Consumers. +// +//===----------------------------------------------------------------------===// + +#ifndef DRIVER_ASTCONSUMERS_H +#define DRIVER_ASTCONSUMERS_H + +#include "llvm/Support/raw_ostream.h" +#include <string> +#include <iosfwd> + +namespace llvm { + class Module; + namespace sys { class Path; } +} +namespace clang { + +class ASTConsumer; +class Diagnostic; +class FileManager; +class Preprocessor; +class PreprocessorFactory; +struct CompileOptions; +class LangOptions; + +// AST pretty-printer: prints out the AST in a format that is close to the +// original C code. The output is intended to be in a format such that +// clang could re-parse the output back into the same AST, but the +// implementation is still incomplete. +ASTConsumer *CreateASTPrinter(llvm::raw_ostream* OS); + +// AST XML-printer: prints out the AST in a XML format +// The output is intended to be in a format such that +// clang or any other tool could re-parse the output back into the same AST, +// but the implementation is still incomplete. +ASTConsumer *CreateASTPrinterXML(llvm::raw_ostream* OS); + +// AST dumper: dumps the raw AST in human-readable form to stderr; this is +// intended for debugging. +ASTConsumer *CreateASTDumper(); + +// Graphical AST viewer: for each function definition, creates a graph of +// the AST and displays it with the graph viewer "dotty". Also outputs +// function declarations to stderr. +ASTConsumer *CreateASTViewer(); + +// DeclContext printer: prints out the DeclContext tree in human-readable form +// to stderr; this is intended for debugging. +ASTConsumer *CreateDeclContextPrinter(); + +// ObjC rewriter: attempts tp rewrite ObjC constructs into pure C code. +// This is considered experimental, and only works with Apple's ObjC runtime. +ASTConsumer *CreateObjCRewriter(const std::string& InFile, + llvm::raw_ostream* OS, + Diagnostic &Diags, + const LangOptions &LOpts, + bool SilenceRewriteMacroWarning); + +// LLVM code generator: uses the code generation backend to generate LLVM +// assembly. This runs optimizations depending on the CompileOptions +// parameter. The output depends on the Action parameter. +enum BackendAction { + Backend_EmitAssembly, // Emit native assembly + Backend_EmitBC, // Emit LLVM bitcode file + Backend_EmitLL, // Emit human-readable LLVM assembly + Backend_EmitNothing // Don't emit anything (benchmarking mode) +}; +ASTConsumer *CreateBackendConsumer(BackendAction Action, + Diagnostic &Diags, + const LangOptions &Features, + const CompileOptions &CompileOpts, + const std::string &ModuleID, + llvm::raw_ostream *OS); + +// HTML printer: uses the rewriter to convert source code to HTML with +// syntax highlighting suitable for viewing in a web-browser. +ASTConsumer* CreateHTMLPrinter(llvm::raw_ostream *OS, Diagnostic &D, + Preprocessor *PP, PreprocessorFactory *PPF); + +// PCH generator: generates a precompiled header file; this file can be +// used later with the PCHReader (clang-cc option -include-pch) +// to speed up compile times. +ASTConsumer *CreatePCHGenerator(const Preprocessor &PP, + llvm::raw_ostream *OS); + +// Block rewriter: rewrites code using the Apple blocks extension to pure +// C code. Output is always sent to stdout. +ASTConsumer *CreateBlockRewriter(const std::string &InFile, + Diagnostic &Diags, + const LangOptions &LangOpts); + +// Inheritance viewer: for C++ code, creates a graph of the inheritance +// tree for the given class and displays it with "dotty". +ASTConsumer *CreateInheritanceViewer(const std::string& clsname); + +} // end clang namespace + +#endif |