InterfaceStubs.cpp 1.4 KB

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