1 //===--- FrontendOptions.h --------------------------------------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
11 #define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
13 #include "clang/Frontend/CommandLineSourceLoc.h"
14 #include "llvm/ADT/StringRef.h"
22 ASTDump, ///< Parse ASTs and dump them.
23 ASTPrint, ///< Parse ASTs and print them.
24 ASTPrintXML, ///< Parse ASTs and print them in XML.
25 ASTView, ///< Parse ASTs and view them in Graphviz.
26 DumpRawTokens, ///< Dump out raw tokens.
27 DumpRecordLayouts, ///< Dump record layout information.
28 DumpTokens, ///< Dump out preprocessed tokens.
29 EmitAssembly, ///< Emit a .s file.
30 EmitBC, ///< Emit a .bc file.
31 EmitHTML, ///< Translate input source into HTML.
32 EmitLLVM, ///< Emit a .ll file.
33 EmitLLVMOnly, ///< Generate LLVM IR, but do not
34 FixIt, ///< Parse and apply any fixits to the source.
35 GeneratePCH, ///< Generate pre-compiled header.
36 GeneratePTH, ///< Generate pre-tokenized header.
37 InheritanceView, ///< View C++ inheritance for a specified class.
38 ParseNoop, ///< Parse with noop callbacks.
39 ParsePrintCallbacks, ///< Parse and print each callback.
40 ParseSyntaxOnly, ///< Parse and perform semantic analysis.
41 PluginAction, ///< Run a plugin action, \see ActionName.
42 PrintDeclContext, ///< Print DeclContext and their Decls.
43 PrintPreprocessedInput, ///< -E mode.
44 RewriteBlocks, ///< ObjC->C Rewriter for Blocks.
45 RewriteMacros, ///< Expand macros but not #includes.
46 RewriteObjC, ///< ObjC->C Rewriter.
47 RewriteTest, ///< Rewriter playground
48 RunAnalysis, ///< Run one or more source code analyses.
49 RunPreprocessorOnly ///< Just lex, no output.
53 /// FrontendOptions - Options for controlling the behavior of the frontend.
54 class FrontendOptions {
66 IK_PreprocessedObjCXX,
71 unsigned DebugCodeCompletionPrinter : 1; ///< Use the debug printer for code
72 /// completion results.
73 unsigned DisableFree : 1; ///< Disable memory freeing on exit.
74 unsigned EmptyInputOnly : 1; ///< Force input files to be treated
75 /// as if they were empty, for timing
76 /// the frontend startup.
77 unsigned RelocatablePCH : 1; ///< When generating PCH files,
78 /// instruct the PCH writer to create
79 /// relocatable PCH files.
80 unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
82 unsigned ShowStats : 1; ///< Show frontend performance
83 /// metrics and statistics.
84 unsigned ShowTimers : 1; ///< Show timers for individual
87 /// The input files and their types.
88 std::vector<std::pair<InputKind, std::string> > Inputs;
90 /// The output file, if any.
91 std::string OutputFile;
93 /// If given, the name for a C++ class to view the inheritance of.
94 std::string ViewClassInheritance;
96 /// A list of locations to apply fix-its at.
97 std::vector<ParsedSourceLocation> FixItLocations;
99 /// If given, enable code completion at the provided location.
100 ParsedSourceLocation CodeCompletionAt;
102 /// The frontend action to perform.
103 frontend::ActionKind ProgramAction;
105 /// The name of the action to run when using a plugin action.
106 std::string ActionName;
110 DebugCodeCompletionPrinter = 1;
113 ProgramAction = frontend::ParseSyntaxOnly;
116 ShowMacrosInCodeCompletion = 0;
121 /// getInputKindForExtension - Return the appropriate input kind for a file
122 /// extension. For example, "c" would return IK_C.
124 /// \return The input kind for the extension, or IK_None if the extension is
126 static InputKind getInputKindForExtension(llvm::StringRef Extension);
129 } // end namespace clang