@@ -1427,15 +1427,12 @@ static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) {
14271427void Driver::buildOutputInfo (const ToolChain &TC, const DerivedArgList &Args,
14281428 const bool BatchMode, const InputFileList &Inputs,
14291429 OutputInfo &OI) const {
1430- auto LinkerInputType = Args.hasArg (options::OPT_lto)
1431- ? file_types::TY_LLVM_BC
1432- : file_types::TY_Object;
14331430 // By default, the driver does not link its output; this will be updated
14341431 // appropriately below if linking is required.
14351432
14361433 OI.CompilerOutputType = driverKind == DriverKind::Interactive
14371434 ? file_types::TY_Nothing
1438- : LinkerInputType ;
1435+ : file_types::TY_Object ;
14391436
14401437 if (const Arg *A = Args.getLastArg (options::OPT_num_threads)) {
14411438 if (BatchMode) {
@@ -1465,14 +1462,14 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
14651462 diag::error_static_emit_executable_disallowed);
14661463
14671464 OI.LinkAction = LinkKind::Executable;
1468- OI.CompilerOutputType = LinkerInputType ;
1465+ OI.CompilerOutputType = file_types::TY_Object ;
14691466 break ;
14701467
14711468 case options::OPT_emit_library:
14721469 OI.LinkAction = Args.hasArg (options::OPT_static) ?
14731470 LinkKind::StaticLibrary :
14741471 LinkKind::DynamicLibrary;
1475- OI.CompilerOutputType = LinkerInputType ;
1472+ OI.CompilerOutputType = file_types::TY_Object ;
14761473 break ;
14771474
14781475 case options::OPT_static:
@@ -1782,18 +1779,6 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
17821779
17831780 }
17841781
1785- if (const Arg *A = Args.getLastArg (options::OPT_lto)) {
1786- auto LTOVariant = llvm::StringSwitch<Optional<OutputInfo::LTOKind>>(A->getValue ())
1787- .Case (" llvm" , OutputInfo::LTOKind::LLVMThin)
1788- .Case (" llvm-full" , OutputInfo::LTOKind::LLVMFull)
1789- .Default (llvm::None);
1790- if (LTOVariant)
1791- OI.LTOVariant = LTOVariant.getValue ();
1792- else
1793- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
1794- A->getAsString (Args), A->getValue ());
1795- }
1796-
17971782 if (TC.getTriple ().isOSWindows ()) {
17981783 if (const Arg *A = Args.getLastArg (options::OPT_libc)) {
17991784 OI.RuntimeVariant =
@@ -2128,17 +2113,15 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
21282113 MergeModuleAction = C.createAction <MergeModuleJobAction>(AllModuleInputs);
21292114 }
21302115
2131- auto PerformLTO = Args.hasArg (options::OPT_lto);
21322116 if (OI.shouldLink () && !AllLinkerInputs.empty ()) {
21332117 JobAction *LinkAction = nullptr ;
21342118
21352119 if (OI.LinkAction == LinkKind::StaticLibrary) {
21362120 LinkAction = C.createAction <StaticLinkJobAction>(AllLinkerInputs,
2137- OI.LinkAction );
2121+ OI.LinkAction );
21382122 } else {
21392123 LinkAction = C.createAction <DynamicLinkJobAction>(AllLinkerInputs,
2140- OI.LinkAction ,
2141- PerformLTO);
2124+ OI.LinkAction );
21422125 }
21432126
21442127 // On ELF platforms there's no built in autolinking mechanism, so we
@@ -2147,7 +2130,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
21472130 const auto &Triple = TC.getTriple ();
21482131 SmallVector<const Action *, 2 > AutolinkExtractInputs;
21492132 for (const Action *A : AllLinkerInputs)
2150- if (A->getType () == OI. CompilerOutputType ) {
2133+ if (A->getType () == file_types::TY_Object ) {
21512134 // Shared objects on ELF platforms don't have a swift1_autolink_entries
21522135 // section in them because the section in the .o files is marked as
21532136 // SHF_EXCLUDE.
@@ -2163,7 +2146,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
21632146 (Triple.getObjectFormat () == llvm::Triple::ELF && !Triple.isPS4 ()) ||
21642147 Triple.getObjectFormat () == llvm::Triple::Wasm ||
21652148 Triple.isOSCygMing ();
2166- if (!AutolinkExtractInputs.empty () && AutolinkExtractRequired && !PerformLTO ) {
2149+ if (!AutolinkExtractInputs.empty () && AutolinkExtractRequired) {
21672150 auto *AutolinkExtractAction =
21682151 C.createAction <AutolinkExtractJobAction>(AutolinkExtractInputs);
21692152 // Takes the same inputs as the linker...
0 commit comments