@@ -221,6 +221,35 @@ static bool wantsObjCRuntime(const llvm::Triple &triple) {
221
221
llvm_unreachable (" unknown Darwin OS" );
222
222
}
223
223
224
+ void
225
+ toolchains::Darwin::addLinkerInputArgs (InvocationInfo &II,
226
+ const JobContext &context) const {
227
+ ArgStringList &Arguments = II.Arguments ;
228
+ if (context.shouldUseInputFileList ()) {
229
+ Arguments.push_back (" -filelist" );
230
+ Arguments.push_back (context.getTemporaryFilePath (" inputs" , " LinkFileList" ));
231
+ II.FilelistInfos .push_back ({Arguments.back (), file_types::TY_Object,
232
+ FilelistInfo::WhichFiles::Input});
233
+ } else {
234
+ addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
235
+ file_types::TY_Object);
236
+ }
237
+
238
+ addInputsOfType (Arguments, context.InputActions , file_types::TY_Object);
239
+
240
+ if (context.OI .CompilerMode == OutputInfo::Mode::SingleCompile)
241
+ addInputsOfType (Arguments, context.Inputs , context.Args ,
242
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
243
+ else
244
+ addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
245
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
246
+
247
+ // Add all .swiftmodule file inputs as arguments, preceded by the
248
+ // "-add_ast_path" linker option.
249
+ addInputsOfType (Arguments, context.InputActions ,
250
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
251
+ }
252
+
224
253
void
225
254
toolchains::Darwin::addArgsToLinkARCLite (ArgStringList &Arguments,
226
255
const JobContext &context) const {
@@ -452,29 +481,7 @@ toolchains::Darwin::constructInvocation(const LinkJobAction &job,
452
481
InvocationInfo II = {LD};
453
482
ArgStringList &Arguments = II.Arguments ;
454
483
455
- if (context.shouldUseInputFileList ()) {
456
- Arguments.push_back (" -filelist" );
457
- Arguments.push_back (context.getTemporaryFilePath (" inputs" , " LinkFileList" ));
458
- II.FilelistInfos .push_back ({Arguments.back (), file_types::TY_Object,
459
- FilelistInfo::WhichFiles::Input});
460
- } else {
461
- addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
462
- file_types::TY_Object);
463
- }
464
-
465
- addInputsOfType (Arguments, context.InputActions , file_types::TY_Object);
466
-
467
- if (context.OI .CompilerMode == OutputInfo::Mode::SingleCompile)
468
- addInputsOfType (Arguments, context.Inputs , context.Args ,
469
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
470
- else
471
- addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
472
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
473
-
474
- // Add all .swiftmodule file inputs as arguments, preceded by the
475
- // "-add_ast_path" linker option.
476
- addInputsOfType (Arguments, context.InputActions ,
477
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
484
+ addLinkerInputArgs (II, context);
478
485
479
486
switch (job.getKind ()) {
480
487
case LinkKind::None:
0 commit comments