ASTConsumers.h revision 207619
1203287Srnoland//===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===// 2203287Srnoland// 3203287Srnoland// The LLVM Compiler Infrastructure 4203287Srnoland// 5203287Srnoland// This file is distributed under the University of Illinois Open Source 6203287Srnoland// License. See LICENSE.TXT for details. 7203287Srnoland// 8203287Srnoland//===----------------------------------------------------------------------===// 9203287Srnoland// 10203287Srnoland// AST Consumers. 11203287Srnoland// 12203287Srnoland//===----------------------------------------------------------------------===// 13203287Srnoland 14203287Srnoland#ifndef DRIVER_ASTCONSUMERS_H 15203287Srnoland#define DRIVER_ASTCONSUMERS_H 16203287Srnoland 17203287Srnoland#include <string> 18203287Srnoland 19203287Srnolandnamespace llvm { 20203287Srnoland class raw_ostream; 21203287Srnoland class Module; 22203287Srnoland class LLVMContext; 23203287Srnoland namespace sys { class Path; } 24203287Srnoland} 25203287Srnolandnamespace clang { 26203287Srnoland 27203287Srnolandclass ASTConsumer; 28203287Srnolandclass CodeGenOptions; 29203287Srnolandclass Diagnostic; 30203287Srnolandclass FileManager; 31203287Srnolandclass LangOptions; 32203287Srnolandclass Preprocessor; 33203287Srnolandclass TargetOptions; 34203287Srnoland 35203287Srnoland// AST pretty-printer: prints out the AST in a format that is close to the 36203287Srnoland// original C code. The output is intended to be in a format such that 37203287Srnoland// clang could re-parse the output back into the same AST, but the 38203287Srnoland// implementation is still incomplete. 39203287SrnolandASTConsumer *CreateASTPrinter(llvm::raw_ostream *OS); 40203287Srnoland 41203287Srnoland// AST XML-printer: prints out the AST in a XML format 42203287Srnoland// The output is intended to be in a format such that 43203287Srnoland// clang or any other tool could re-parse the output back into the same AST, 44203287Srnoland// but the implementation is still incomplete. 45203287SrnolandASTConsumer *CreateASTPrinterXML(llvm::raw_ostream *OS); 46203287Srnoland 47203287Srnoland// AST dumper: dumps the raw AST in human-readable form to stderr; this is 48203287Srnoland// intended for debugging. 49203287SrnolandASTConsumer *CreateASTDumper(); 50203287Srnoland 51203287Srnoland// Graphical AST viewer: for each function definition, creates a graph of 52203287Srnoland// the AST and displays it with the graph viewer "dotty". Also outputs 53203287Srnoland// function declarations to stderr. 54203287SrnolandASTConsumer *CreateASTViewer(); 55203287Srnoland 56203287Srnoland// DeclContext printer: prints out the DeclContext tree in human-readable form 57203287Srnoland// to stderr; this is intended for debugging. 58203287SrnolandASTConsumer *CreateDeclContextPrinter(); 59203287Srnoland 60203287Srnoland// ObjC rewriter: attempts tp rewrite ObjC constructs into pure C code. 61203287Srnoland// This is considered experimental, and only works with Apple's ObjC runtime. 62203287SrnolandASTConsumer *CreateObjCRewriter(const std::string &InFile, 63203287Srnoland llvm::raw_ostream *OS, 64203287Srnoland Diagnostic &Diags, 65203287Srnoland const LangOptions &LOpts, 66203287Srnoland bool SilenceRewriteMacroWarning); 67203287Srnoland 68203287Srnoland/// CreateHTMLPrinter - Create an AST consumer which rewrites source code to 69203287Srnoland/// HTML with syntax highlighting suitable for viewing in a web-browser. 70203287SrnolandASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP, 71203287Srnoland bool SyntaxHighlight = true, 72203287Srnoland bool HighlightMacros = true); 73203287Srnoland 74203287Srnoland// PCH generator: generates a precompiled header file; this file can be used 75203287Srnoland// later with the PCHReader (clang -cc1 option -include-pch) to speed up compile 76203287Srnoland// times. 77203287SrnolandASTConsumer *CreatePCHGenerator(const Preprocessor &PP, 78203287Srnoland llvm::raw_ostream *OS, 79203287Srnoland const char *isysroot = 0); 80203287Srnoland 81203287Srnoland// Inheritance viewer: for C++ code, creates a graph of the inheritance 82203287Srnoland// tree for the given class and displays it with "dotty". 83203287SrnolandASTConsumer *CreateInheritanceViewer(const std::string& clsname); 84203287Srnoland 85203287Srnoland} // end clang namespace 86203287Srnoland 87203287Srnoland#endif 88203287Srnoland