================
@@ -3637,3 +3637,28 @@ void tools::setComplexRange(const Driver &D, StringRef 
NewOpt,
   LastOpt = NewOpt;
   Range = NewRange;
 }
+
+void tools::constructLlvmLinkCommand(Compilation &C, const Tool &T,
+                                     const JobAction &JA,
+                                     const InputInfoList &JobInputs,
+                                     const ArgStringList &LinkerInputs,
+                                     const InputInfo &Output,
+                                     const llvm::opt::ArgList &Args,
+                                     const char *OutputFilename) {
+  // Construct llvm-link command.
+  // The output from llvm-link is a bitcode file.
+
+  assert(!LinkerInputs.empty() && !JobInputs.empty() &&
+         "Must have at least one input.");
+
+  ArgStringList LlvmLinkArgs(
----------------
sarnex wrote:

Thanks for the review! 
Right, this function expects that the inputs to `llvm-link` will be specified 
by the caller, but the output is handled by this function.

The reason for this is to reduce some code duplication. We had 3 callsites 
constructing calls to `llvm-link` that all constructed the inputs in slightly 
different ways. The idea here is to reuse all the code we can, so move the 
shared common logic to this function and have the caller deal with the 
callsite-specific logic (here the linker inputs).

https://github.com/llvm/llvm-project/pull/169572
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to