1 //===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
14 #ifndef DRIVER_ASTCONSUMERS_H
15 #define DRIVER_ASTCONSUMERS_H
23 namespace sys { class Path; }
35 // AST pretty-printer: prints out the AST in a format that is close to the
36 // original C code. The output is intended to be in a format such that
37 // clang could re-parse the output back into the same AST, but the
38 // implementation is still incomplete.
39 ASTConsumer *CreateASTPrinter(llvm::raw_ostream *OS);
41 // AST XML-printer: prints out the AST in a XML format
42 // The output is intended to be in a format such that
43 // clang or any other tool could re-parse the output back into the same AST,
44 // but the implementation is still incomplete.
45 ASTConsumer *CreateASTPrinterXML(llvm::raw_ostream *OS);
47 // AST dumper: dumps the raw AST in human-readable form to stderr; this is
48 // intended for debugging.
49 ASTConsumer *CreateASTDumper();
51 // Graphical AST viewer: for each function definition, creates a graph of
52 // the AST and displays it with the graph viewer "dotty". Also outputs
53 // function declarations to stderr.
54 ASTConsumer *CreateASTViewer();
56 // DeclContext printer: prints out the DeclContext tree in human-readable form
57 // to stderr; this is intended for debugging.
58 ASTConsumer *CreateDeclContextPrinter();
60 // ObjC rewriter: attempts tp rewrite ObjC constructs into pure C code.
61 // This is considered experimental, and only works with Apple's ObjC runtime.
62 ASTConsumer *CreateObjCRewriter(const std::string &InFile,
63 llvm::raw_ostream *OS,
65 const LangOptions &LOpts,
66 bool SilenceRewriteMacroWarning);
68 /// CreateHTMLPrinter - Create an AST consumer which rewrites source code to
69 /// HTML with syntax highlighting suitable for viewing in a web-browser.
70 ASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP,
71 bool SyntaxHighlight = true,
72 bool HighlightMacros = true);
74 // PCH generator: generates a precompiled header file; this file can be used
75 // later with the PCHReader (clang -cc1 option -include-pch) to speed up compile
77 ASTConsumer *CreatePCHGenerator(const Preprocessor &PP,
78 llvm::raw_ostream *OS,
79 const char *isysroot = 0);
81 // Inheritance viewer: for C++ code, creates a graph of the inheritance
82 // tree for the given class and displays it with "dotty".
83 ASTConsumer *CreateInheritanceViewer(const std::string& clsname);
85 } // end clang namespace