xref: /freebsd-src/contrib/llvm-project/clang/lib/Driver/ToolChains/InterfaceStubs.cpp (revision a7dea1671b87c07d2d266f836bfa8b58efc7c134)
1*a7dea167SDimitry Andric //===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//
2*a7dea167SDimitry Andric //
3*a7dea167SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*a7dea167SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*a7dea167SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*a7dea167SDimitry Andric //
7*a7dea167SDimitry Andric //===----------------------------------------------------------------------===//
8*a7dea167SDimitry Andric 
9*a7dea167SDimitry Andric #include "InterfaceStubs.h"
10*a7dea167SDimitry Andric #include "CommonArgs.h"
11*a7dea167SDimitry Andric #include "clang/Driver/Compilation.h"
12*a7dea167SDimitry Andric 
13*a7dea167SDimitry Andric namespace clang {
14*a7dea167SDimitry Andric namespace driver {
15*a7dea167SDimitry Andric namespace tools {
16*a7dea167SDimitry Andric namespace ifstool {
17*a7dea167SDimitry Andric void Merger::ConstructJob(Compilation &C, const JobAction &JA,
18*a7dea167SDimitry Andric                           const InputInfo &Output, const InputInfoList &Inputs,
19*a7dea167SDimitry Andric                           const llvm::opt::ArgList &Args,
20*a7dea167SDimitry Andric                           const char *LinkingOutput) const {
21*a7dea167SDimitry Andric   std::string Merger = getToolChain().GetProgramPath(getShortName());
22*a7dea167SDimitry Andric   llvm::opt::ArgStringList CmdArgs;
23*a7dea167SDimitry Andric   CmdArgs.push_back("-action");
24*a7dea167SDimitry Andric   CmdArgs.push_back(Args.getLastArg(options::OPT_emit_merged_ifs)
25*a7dea167SDimitry Andric                         ? "write-ifs"
26*a7dea167SDimitry Andric                         : "write-bin");
27*a7dea167SDimitry Andric   CmdArgs.push_back("-o");
28*a7dea167SDimitry Andric   CmdArgs.push_back(Output.getFilename());
29*a7dea167SDimitry Andric   for (const auto &Input : Inputs)
30*a7dea167SDimitry Andric     CmdArgs.push_back(Input.getFilename());
31*a7dea167SDimitry Andric   C.addCommand(std::make_unique<Command>(JA, *this, Args.MakeArgString(Merger),
32*a7dea167SDimitry Andric                                          CmdArgs, Inputs));
33*a7dea167SDimitry Andric }
34*a7dea167SDimitry Andric } // namespace ifstool
35*a7dea167SDimitry Andric } // namespace tools
36*a7dea167SDimitry Andric } // namespace driver
37*a7dea167SDimitry Andric } // namespace clang
38