CompilerInvocation.h revision 2811ccf48d6d898c42cc4cfad37abedb36236d20
1//===-- CompilerInvocation.h - Compiler Invocation Helper Data --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_ 11#define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_ 12 13#include "clang/Basic/LangOptions.h" 14#include "clang/CodeGen/CodeGenOptions.h" 15#include "clang/Frontend/AnalysisConsumer.h" 16#include "clang/Frontend/DependencyOutputOptions.h" 17#include "clang/Frontend/DiagnosticOptions.h" 18#include "clang/Frontend/HeaderSearchOptions.h" 19#include "clang/Frontend/PreprocessorOptions.h" 20#include "clang/Frontend/PreprocessorOutputOptions.h" 21#include "llvm/ADT/StringMap.h" 22#include <string> 23 24namespace clang { 25 26/// CompilerInvocation - Helper class for holding the data necessary to invoke 27/// the compiler. 28/// 29/// This class is designed to represent an abstract "invocation" of the 30/// compiler, including data such as the include paths, the code generation 31/// options, the warning flags, and so on. 32class CompilerInvocation { 33 /// Options controlling the static analyzer. 34 AnalyzerOptions AnalyzerOpts; 35 36 /// Options controlling IRgen and the backend. 37 CodeGenOptions CodeGenOpts; 38 39 /// Options controlling dependency output. 40 DependencyOutputOptions DependencyOutputOpts; 41 42 /// Options controlling the diagnostic engine. 43 DiagnosticOptions DiagOpts; 44 45 /// Options controlling the #include directive. 46 HeaderSearchOptions HeaderSearchOpts; 47 48 /// Options controlling the language variant. 49 LangOptions LangOpts; 50 51 /// Options controlling the preprocessor (aside from #include handling). 52 PreprocessorOptions PreprocessorOpts; 53 54 /// Options controlling preprocessed output. 55 PreprocessorOutputOptions PreprocessorOutputOpts; 56 57 /// The location for the output file. This is optional only for compiler 58 /// invocations which have no output. 59 std::string OutputFile; 60 61public: 62 CompilerInvocation() {} 63 64 /// @name Invidual Options 65 /// @{ 66 67 std::string &getOutputFile() { return OutputFile; } 68 const std::string &getOutputFile() const { return OutputFile; } 69 70 /// @} 71 /// @name Option Subgroups 72 /// @{ 73 74 AnalyzerOptions &getAnalyzerOpts() { return AnalyzerOpts; } 75 const AnalyzerOptions &getAnalyzerOpts() const { 76 return AnalyzerOpts; 77 } 78 79 CodeGenOptions &getCodeGenOpts() { return CodeGenOpts; } 80 const CodeGenOptions &getCodeGenOpts() const { 81 return CodeGenOpts; 82 } 83 84 DependencyOutputOptions &getDependencyOutputOpts() { 85 return DependencyOutputOpts; 86 } 87 const DependencyOutputOptions &getDependencyOutputOpts() const { 88 return DependencyOutputOpts; 89 } 90 91 DiagnosticOptions &getDiagnosticOpts() { return DiagOpts; } 92 const DiagnosticOptions &getDiagnosticOpts() const { return DiagOpts; } 93 94 HeaderSearchOptions &getHeaderSearchOpts() { return HeaderSearchOpts; } 95 const HeaderSearchOptions &getHeaderSearchOpts() const { 96 return HeaderSearchOpts; 97 } 98 99 LangOptions &getLangOpts() { return LangOpts; } 100 const LangOptions &getLangOpts() const { return LangOpts; } 101 102 PreprocessorOptions &getPreprocessorOpts() { return PreprocessorOpts; } 103 const PreprocessorOptions &getPreprocessorOpts() const { 104 return PreprocessorOpts; 105 } 106 107 PreprocessorOutputOptions &getPreprocessorOutputOpts() { 108 return PreprocessorOutputOpts; 109 } 110 const PreprocessorOutputOptions &getPreprocessorOutputOpts() const { 111 return PreprocessorOutputOpts; 112 } 113 114 /// @} 115}; 116 117} // end namespace clang 118 119#endif 120