Changeset View
Changeset View
Standalone View
Standalone View
flang/lib/Frontend/CompilerInvocation.cpp
//===- CompilerInvocation.cpp ---------------------------------------------===// | //===- CompilerInvocation.cpp ---------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "flang/Frontend/CompilerInvocation.h" | #include "flang/Frontend/CompilerInvocation.h" | ||||
#include "flang/Common/Fortran-features.h" | #include "flang/Common/Fortran-features.h" | ||||
#include "flang/Frontend/PreprocessorOptions.h" | #include "flang/Frontend/PreprocessorOptions.h" | ||||
#include "flang/Frontend/TargetOptions.h" | |||||
#include "flang/Semantics/semantics.h" | #include "flang/Semantics/semantics.h" | ||||
#include "flang/Version.inc" | #include "flang/Version.inc" | ||||
#include "clang/Basic/AllDiagnostics.h" | #include "clang/Basic/AllDiagnostics.h" | ||||
#include "clang/Basic/DiagnosticDriver.h" | #include "clang/Basic/DiagnosticDriver.h" | ||||
#include "clang/Basic/DiagnosticOptions.h" | #include "clang/Basic/DiagnosticOptions.h" | ||||
#include "clang/Driver/DriverDiagnostic.h" | #include "clang/Driver/DriverDiagnostic.h" | ||||
#include "clang/Driver/Options.h" | #include "clang/Driver/Options.h" | ||||
#include "llvm/ADT/StringRef.h" | #include "llvm/ADT/StringRef.h" | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
bool Fortran::frontend::ParseDiagnosticArgs(clang::DiagnosticOptions &opts, | bool Fortran::frontend::ParseDiagnosticArgs(clang::DiagnosticOptions &opts, | ||||
llvm::opt::ArgList &args, bool defaultDiagColor) { | llvm::opt::ArgList &args, bool defaultDiagColor) { | ||||
opts.ShowColors = parseShowColorsArgs(args, defaultDiagColor); | opts.ShowColors = parseShowColorsArgs(args, defaultDiagColor); | ||||
return true; | return true; | ||||
} | } | ||||
/// Parses all target input arguments and populates the target | |||||
/// options accordingly. | |||||
/// | |||||
/// \param [in] opts The target options instance to update | |||||
/// \param [in] args The list of input arguments (from the compiler invocation) | |||||
static void ParseTargetArgs(TargetOptions &opts, llvm::opt::ArgList &args) { | |||||
opts.triple = args.getLastArgValue(clang::driver::options::OPT_triple); | |||||
} | |||||
// Tweak the frontend configuration based on the frontend action | // Tweak the frontend configuration based on the frontend action | ||||
static void setUpFrontendBasedOnAction(FrontendOptions &opts) { | static void setUpFrontendBasedOnAction(FrontendOptions &opts) { | ||||
assert(opts.programAction != Fortran::frontend::InvalidAction && | assert(opts.programAction != Fortran::frontend::InvalidAction && | ||||
"Fortran frontend action not set!"); | "Fortran frontend action not set!"); | ||||
if (opts.programAction == DebugDumpParsingLog) | if (opts.programAction == DebugDumpParsingLog) | ||||
opts.instrumentedParse = true; | opts.instrumentedParse = true; | ||||
▲ Show 20 Lines • Show All 459 Lines • ▼ Show 20 Lines | if (opts.findNearest(argString, nearest, includedFlagsBitmask) > 1) | ||||
diags.Report(clang::diag::err_drv_unknown_argument) << argString; | diags.Report(clang::diag::err_drv_unknown_argument) << argString; | ||||
else | else | ||||
diags.Report(clang::diag::err_drv_unknown_argument_with_suggestion) | diags.Report(clang::diag::err_drv_unknown_argument_with_suggestion) | ||||
<< argString << nearest; | << argString << nearest; | ||||
success = false; | success = false; | ||||
} | } | ||||
success &= ParseFrontendArgs(res.frontendOpts(), args, diags); | success &= ParseFrontendArgs(res.frontendOpts(), args, diags); | ||||
ParseTargetArgs(res.targetOpts(), args); | |||||
parsePreprocessorArgs(res.preprocessorOpts(), args); | parsePreprocessorArgs(res.preprocessorOpts(), args); | ||||
success &= parseSemaArgs(res, args, diags); | success &= parseSemaArgs(res, args, diags); | ||||
success &= parseDialectArgs(res, args, diags); | success &= parseDialectArgs(res, args, diags); | ||||
success &= parseDiagArgs(res, args, diags); | success &= parseDiagArgs(res, args, diags); | ||||
return success; | return success; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |