[PATCH] D94675: [clang][cli] NFC: Decrease the scope of ParseCodeGenArgs parameters
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 14 04:39:17 PST 2021
jansvoboda11 created this revision.
jansvoboda11 added reviewers: dexonsmith, Bigcheese.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94675
Files:
clang/lib/Frontend/CompilerInvocation.cpp
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -405,6 +405,8 @@
llvm::Triple T(TargetOpts.Triple);
llvm::Triple::ArchType Arch = T.getArch();
+ CodeGenOpts.CodeModel = TargetOpts.CodeModel;
+
if (LangOpts.getExceptionHandling() != llvm::ExceptionHandling::None &&
T.isWindowsMSVCEnvironment())
Diags.Report(diag::err_fe_invalid_exception_model)
@@ -901,11 +903,9 @@
}
static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
- DiagnosticsEngine &Diags,
- const TargetOptions &TargetOpts,
- const FrontendOptions &FrontendOpts) {
+ DiagnosticsEngine &Diags, const llvm::Triple &T,
+ const std::string &OutputFile) {
bool Success = true;
- llvm::Triple Triple = llvm::Triple(TargetOpts.Triple);
unsigned OptimizationLevel = getOptimizationLevel(Args, IK, Diags);
// TODO: This could be done in Driver
@@ -964,7 +964,6 @@
llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::mips,
llvm::Triple::mipsel, llvm::Triple::mips64, llvm::Triple::mips64el};
- llvm::Triple T(TargetOpts.Triple);
if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() &&
llvm::is_contained(DebugEntryValueArchs, T.getArch()))
Opts.EmitCallSiteInfo = true;
@@ -990,8 +989,6 @@
if (!Opts.ProfileInstrumentUsePath.empty())
setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath);
- Opts.CodeModel = TargetOpts.CodeModel;
-
if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ)) {
Opts.TimePasses = true;
@@ -1036,8 +1033,8 @@
if (Arg *A = Args.getLastArg(OPT_save_temps_EQ))
Opts.SaveTempsFilePrefix =
llvm::StringSwitch<std::string>(A->getValue())
- .Case("obj", FrontendOpts.OutputFile)
- .Default(llvm::sys::path::filename(FrontendOpts.OutputFile).str());
+ .Case("obj", OutputFile)
+ .Default(llvm::sys::path::filename(OutputFile).str());
// The memory profile runtime appends the pid to make this name more unique.
const char *MemProfileBasename = "memprof.profraw";
@@ -2937,11 +2934,11 @@
InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
LangOpts.IsHeaderFile);
ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
- Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,
- Res.getTargetOpts(), Res.getFrontendOpts());
+ llvm::Triple T(Res.getTargetOpts().Triple);
+ Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags, T,
+ Res.getFrontendOpts().OutputFile);
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args,
Res.getFileSystemOpts().WorkingDir);
- llvm::Triple T(Res.getTargetOpts().Triple);
if (DashX.getFormat() == InputKind::Precompiled ||
DashX.getLanguage() == Language::LLVM_IR) {
// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94675.316624.patch
Type: text/x-patch
Size: 3256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210114/e41ce810/attachment-0001.bin>
More information about the cfe-commits
mailing list