[cfe-commits] r71992 - /cfe/trunk/tools/clang-cc/ASTConsumers.h

Eli Friedman eli.friedman at gmail.com
Sun May 17 18:16:22 PDT 2009


Author: efriedma
Date: Sun May 17 20:16:21 2009
New Revision: 71992

URL: http://llvm.org/viewvc/llvm-project?rev=71992&view=rev
Log:
Add some comments to ASTConsumers.h describing what the different 
ASTConsumers actually do.


Modified:
    cfe/trunk/tools/clang-cc/ASTConsumers.h

Modified: cfe/trunk/tools/clang-cc/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/ASTConsumers.h?rev=71992&r1=71991&r2=71992&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/ASTConsumers.h (original)
+++ cfe/trunk/tools/clang-cc/ASTConsumers.h Sun May 17 20:16:21 2009
@@ -32,24 +32,42 @@
 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 = NULL);
 
+// AST dumper: dumps the raw AST in human-readable form to stderr; this is
+// intended for debugging. A normal dump is done with FullDump = false;
+// with FullDump = true, the dumper waits until the end of the translation
+// unit to dump the AST.
 ASTConsumer *CreateASTDumper(bool FullDump);
 
+// 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 *CreateCodeRewriterTest(const std::string& InFile,
                                     const std::string& OutFile,
                                     Diagnostic &Diags,
                                     const LangOptions &LOpts);
-  
+
+// 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,
-  Backend_EmitBC,
-  Backend_EmitLL,
-  Backend_EmitNothing
+  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,
@@ -58,19 +76,30 @@
                                    const std::string &InFile,
                                    const std::string &OutFile);
 
+// HTML printer: uses the rewriter to convert source code to HTML with
+// syntax highlighting suitable for viewing in a web-browser.
 ASTConsumer* CreateHTMLPrinter(const std::string &OutFile, 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,
                                 const std::string &OutFile);
 
+// Block rewriter: rewrites code using the Apple blocks extension to pure
+// C code.
 ASTConsumer *CreateBlockRewriter(const std::string &InFile,
                                  const std::string &OutFile,
                                  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);
 
+// Analyzer: runs various code analysis passes.  (The exact analyses
+// run is controlled by command-line options.)
 ASTConsumer* CreateAnalysisConsumer(Diagnostic &diags, Preprocessor *pp,
                                     PreprocessorFactory *ppf,
                                     const LangOptions &lopts,





More information about the cfe-commits mailing list