40class CompilerInvocationBase {
47 CompilerInvocationBase();
48 CompilerInvocationBase(
const CompilerInvocationBase &x);
49 ~CompilerInvocationBase();
51 clang::DiagnosticOptions &getDiagnosticOpts() {
54 const clang::DiagnosticOptions &getDiagnosticOpts()
const {
59 const PreprocessorOptions &getPreprocessorOpts()
const {
64class CompilerInvocation :
public CompilerInvocationBase {
68 FrontendOptions frontendOpts;
90 std::string allCompilerInvocOpts;
95 std::string moduleDir =
".";
97 std::string moduleFileSuffix =
".mod";
99 bool debugModuleDir =
false;
100 bool hermeticModuleFileOutput =
false;
109 bool useAnalyzedObjectsForUnparse =
true;
115 size_t maxErrors = 0;
116 bool warnAsErr =
false;
118 bool enableConformanceChecks =
false;
119 bool enableUsageChecks =
false;
120 bool disableWarnings =
false;
129 o <<
"(bad expression)";
132 [](llvm::raw_ostream &o,
137 o <<
"(bad assignment)";
141 x.AsFortran(o <<
"CALL ");
150 CompilerInvocation() =
default;
152 FrontendOptions &getFrontendOpts() {
return frontendOpts; }
153 const FrontendOptions &getFrontendOpts()
const {
return frontendOpts; }
159 const TargetOptions &getTargetOpts()
const {
return targetOpts; }
162 const CodeGenOptions &getCodeGenOpts()
const {
return codeGenOpts; }
173 std::unique_ptr<Fortran::semantics::SemanticsContext>
175 llvm::StringRef targetFeatures);
177 std::string &getModuleDir() {
return moduleDir; }
178 const std::string &getModuleDir()
const {
return moduleDir; }
180 std::string &getModuleFileSuffix() {
return moduleFileSuffix; }
181 const std::string &getModuleFileSuffix()
const {
return moduleFileSuffix; }
183 bool &getDebugModuleDir() {
return debugModuleDir; }
184 const bool &getDebugModuleDir()
const {
return debugModuleDir; }
186 bool &getHermeticModuleFileOutput() {
return hermeticModuleFileOutput; }
187 const bool &getHermeticModuleFileOutput()
const {
188 return hermeticModuleFileOutput;
190 size_t &getMaxErrors() {
return maxErrors; }
191 const size_t &getMaxErrors()
const {
return maxErrors; }
193 bool &getWarnAsErr() {
return warnAsErr; }
194 const bool &getWarnAsErr()
const {
return warnAsErr; }
196 bool &getUseAnalyzedObjectsForUnparse() {
197 return useAnalyzedObjectsForUnparse;
199 const bool &getUseAnalyzedObjectsForUnparse()
const {
200 return useAnalyzedObjectsForUnparse;
203 bool &getEnableConformanceChecks() {
return enableConformanceChecks; }
204 const bool &getEnableConformanceChecks()
const {
205 return enableConformanceChecks;
208 const char *getArgv0() {
return argv0; }
210 bool &getEnableUsageChecks() {
return enableUsageChecks; }
211 const bool &getEnableUsageChecks()
const {
return enableUsageChecks; }
213 bool &getDisableWarnings() {
return disableWarnings; }
214 const bool &getDisableWarnings()
const {
return disableWarnings; }
230 bool getEnableTimers()
const {
return enableTimers; }
238 clang::DiagnosticsEngine &diags,
239 const char *argv0 =
nullptr);
242 void setEnableConformanceChecks() { enableConformanceChecks =
true; }
245 void setEnableUsageChecks() { enableUsageChecks =
true; }
248 void setDisableWarnings() { disableWarnings =
true; }
253 void setModuleDir(std::string &dir) { moduleDir = dir; }
255 void setModuleFileSuffix(
const char *suffix) {
256 moduleFileSuffix = std::string(suffix);
259 void setDebugModuleDir(
bool flag) { debugModuleDir = flag; }
260 void setHermeticModuleFileOutput(
bool flag) {
261 hermeticModuleFileOutput = flag;
264 void setMaxErrors(
size_t maxErrors) { this->maxErrors = maxErrors; }
265 void setWarnAsErr(
bool flag) { warnAsErr = flag; }
267 void setUseAnalyzedObjectsForUnparse(
bool flag) {
268 useAnalyzedObjectsForUnparse = flag;
static bool createFromArgs(CompilerInvocation &res, llvm::ArrayRef< const char * > commandLineArgs, clang::DiagnosticsEngine &diags, const char *argv0=nullptr)
Definition CompilerInvocation.cpp:1779
std::unique_ptr< Fortran::semantics::SemanticsContext > getSemanticsCtx(Fortran::parser::AllCookedSources &allCookedSources, llvm::StringRef targetFeatures)
Creates and configures semantics context based on the compilation flags.
Definition CompilerInvocation.cpp:2157