@@ -224,6 +224,35 @@ static bool wantsObjCRuntime(const llvm::Triple &triple) {
224
224
llvm_unreachable (" unknown Darwin OS" );
225
225
}
226
226
227
+ void
228
+ toolchains::Darwin::addLinkerInputArgs (InvocationInfo &II,
229
+ const JobContext &context) const {
230
+ ArgStringList &Arguments = II.Arguments ;
231
+ if (context.shouldUseInputFileList ()) {
232
+ Arguments.push_back (" -filelist" );
233
+ Arguments.push_back (context.getTemporaryFilePath (" inputs" , " LinkFileList" ));
234
+ II.FilelistInfos .push_back ({Arguments.back (), file_types::TY_Object,
235
+ FilelistInfo::WhichFiles::Input});
236
+ } else {
237
+ addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
238
+ file_types::TY_Object);
239
+ }
240
+
241
+ addInputsOfType (Arguments, context.InputActions , file_types::TY_Object);
242
+
243
+ if (context.OI .CompilerMode == OutputInfo::Mode::SingleCompile)
244
+ addInputsOfType (Arguments, context.Inputs , context.Args ,
245
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
246
+ else
247
+ addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
248
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
249
+
250
+ // Add all .swiftmodule file inputs as arguments, preceded by the
251
+ // "-add_ast_path" linker option.
252
+ addInputsOfType (Arguments, context.InputActions ,
253
+ file_types::TY_SwiftModuleFile, " -add_ast_path" );
254
+ }
255
+
227
256
static void findARCLiteLibPath (const toolchains::Darwin &TC,
228
257
llvm::SmallVectorImpl<char > &ARCLiteLib) {
229
258
auto & D = TC.getDriver ();
@@ -509,29 +538,7 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job,
509
538
InvocationInfo II = {LD};
510
539
ArgStringList &Arguments = II.Arguments ;
511
540
512
- if (context.shouldUseInputFileList ()) {
513
- Arguments.push_back (" -filelist" );
514
- Arguments.push_back (context.getTemporaryFilePath (" inputs" , " LinkFileList" ));
515
- II.FilelistInfos .push_back ({Arguments.back (), file_types::TY_Object,
516
- FilelistInfo::WhichFiles::Input});
517
- } else {
518
- addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
519
- file_types::TY_Object);
520
- }
521
-
522
- addInputsOfType (Arguments, context.InputActions , file_types::TY_Object);
523
-
524
- if (context.OI .CompilerMode == OutputInfo::Mode::SingleCompile)
525
- addInputsOfType (Arguments, context.Inputs , context.Args ,
526
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
527
- else
528
- addPrimaryInputsOfType (Arguments, context.Inputs , context.Args ,
529
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
530
-
531
- // Add all .swiftmodule file inputs as arguments, preceded by the
532
- // "-add_ast_path" linker option.
533
- addInputsOfType (Arguments, context.InputActions ,
534
- file_types::TY_SwiftModuleFile, " -add_ast_path" );
541
+ addLinkerInputArgs (II, context);
535
542
536
543
switch (job.getKind ()) {
537
544
case LinkKind::None:
0 commit comments