@@ -405,6 +405,8 @@ static void FixupInvocation(CompilerInvocation &Invocation,
405
405
llvm::Triple T (TargetOpts.Triple );
406
406
llvm::Triple::ArchType Arch = T.getArch ();
407
407
408
+ CodeGenOpts.CodeModel = TargetOpts.CodeModel ;
409
+
408
410
if (LangOpts.getExceptionHandling () != llvm::ExceptionHandling::None &&
409
411
T.isWindowsMSVCEnvironment ())
410
412
Diags.Report (diag::err_fe_invalid_exception_model)
@@ -901,11 +903,9 @@ static void setPGOUseInstrumentor(CodeGenOptions &Opts,
901
903
}
902
904
903
905
static bool ParseCodeGenArgs (CodeGenOptions &Opts, ArgList &Args, InputKind IK,
904
- DiagnosticsEngine &Diags,
905
- const TargetOptions &TargetOpts,
906
- const FrontendOptions &FrontendOpts) {
906
+ DiagnosticsEngine &Diags, const llvm::Triple &T,
907
+ const std::string &OutputFile) {
907
908
bool Success = true ;
908
- llvm::Triple Triple = llvm::Triple (TargetOpts.Triple );
909
909
910
910
unsigned OptimizationLevel = getOptimizationLevel (Args, IK, Diags);
911
911
// TODO: This could be done in Driver
@@ -964,7 +964,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
964
964
llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::mips,
965
965
llvm::Triple::mipsel, llvm::Triple::mips64, llvm::Triple::mips64el};
966
966
967
- llvm::Triple T (TargetOpts.Triple );
968
967
if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo () &&
969
968
llvm::is_contained (DebugEntryValueArchs, T.getArch ()))
970
969
Opts.EmitCallSiteInfo = true ;
@@ -990,8 +989,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
990
989
if (!Opts.ProfileInstrumentUsePath .empty ())
991
990
setPGOUseInstrumentor (Opts, Opts.ProfileInstrumentUsePath );
992
991
993
- Opts.CodeModel = TargetOpts.CodeModel ;
994
-
995
992
if (const Arg *A = Args.getLastArg (OPT_ftime_report, OPT_ftime_report_EQ)) {
996
993
Opts.TimePasses = true ;
997
994
@@ -1036,8 +1033,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
1036
1033
if (Arg *A = Args.getLastArg (OPT_save_temps_EQ))
1037
1034
Opts.SaveTempsFilePrefix =
1038
1035
llvm::StringSwitch<std::string>(A->getValue ())
1039
- .Case (" obj" , FrontendOpts. OutputFile )
1040
- .Default (llvm::sys::path::filename (FrontendOpts. OutputFile ).str ());
1036
+ .Case (" obj" , OutputFile)
1037
+ .Default (llvm::sys::path::filename (OutputFile).str ());
1041
1038
1042
1039
// The memory profile runtime appends the pid to make this name more unique.
1043
1040
const char *MemProfileBasename = " memprof.profraw" ;
@@ -2937,11 +2934,11 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
2937
2934
InputKind DashX = ParseFrontendArgs (Res.getFrontendOpts (), Args, Diags,
2938
2935
LangOpts.IsHeaderFile );
2939
2936
ParseTargetArgs (Res.getTargetOpts (), Args, Diags);
2940
- Success &= ParseCodeGenArgs (Res.getCodeGenOpts (), Args, DashX, Diags,
2941
- Res.getTargetOpts (), Res.getFrontendOpts ());
2937
+ llvm::Triple T (Res.getTargetOpts ().Triple );
2938
+ Success &= ParseCodeGenArgs (Res.getCodeGenOpts (), Args, DashX, Diags, T,
2939
+ Res.getFrontendOpts ().OutputFile );
2942
2940
ParseHeaderSearchArgs (Res.getHeaderSearchOpts (), Args,
2943
2941
Res.getFileSystemOpts ().WorkingDir );
2944
- llvm::Triple T (Res.getTargetOpts ().Triple );
2945
2942
if (DashX.getFormat () == InputKind::Precompiled ||
2946
2943
DashX.getLanguage () == Language::LLVM_IR) {
2947
2944
// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
0 commit comments