head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.2
	netbsd-11-0-RC3:1.1.1.2
	netbsd-11-0-RC2:1.1.1.2
	netbsd-11-0-RC1:1.1.1.2
	perseant-exfatfs-base-20250801:1.1.1.2
	netbsd-11:1.1.1.2.0.8
	netbsd-11-base:1.1.1.2
	netbsd-10-1-RELEASE:1.1.1.2
	perseant-exfatfs-base-20240630:1.1.1.2
	perseant-exfatfs:1.1.1.2.0.6
	perseant-exfatfs-base:1.1.1.2
	netbsd-10-0-RELEASE:1.1.1.2
	netbsd-10-0-RC6:1.1.1.2
	netbsd-10-0-RC5:1.1.1.2
	netbsd-10-0-RC4:1.1.1.2
	netbsd-10-0-RC3:1.1.1.2
	netbsd-10-0-RC2:1.1.1.2
	netbsd-10-0-RC1:1.1.1.2
	netbsd-10:1.1.1.2.0.4
	netbsd-10-base:1.1.1.2
	cjep_sun2x-base1:1.1.1.2
	cjep_sun2x:1.1.1.2.0.2
	cjep_sun2x-base:1.1.1.2
	cjep_staticlib_x-base1:1.1.1.2
	LLVM-249b40b558955afe5ac2b549edcf2d7f859c8cc9:1.1.1.2
	cjep_staticlib_x:1.1.1.1.0.4
	cjep_staticlib_x-base:1.1.1.1
	phil-wifi-20200421:1.1.1.1
	phil-wifi-20200411:1.1.1.1
	is-mlppp:1.1.1.1.0.2
	is-mlppp-base:1.1.1.1
	phil-wifi-20200406:1.1.1.1
	phil-wifi-20191119:1.1.1.1
	LLVM-01f3a59fb3e2542fce74c768718f594d0debd0da:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2019.11.08.14.30.02;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	lIv69tfiG0KHw3KB;

1.1.1.1
date	2019.11.08.14.30.02;	author joerg;	state Exp;
branches
	1.1.1.1.4.1;
next	1.1.1.2;
commitid	lIv69tfiG0KHw3KB;

1.1.1.2
date	2021.05.30.01.25.34;	author joerg;	state Exp;
branches;
next	;
commitid	uhgdinROdC6tU6VC;

1.1.1.1.4.1
date	2021.05.31.22.07.14;	author cjep;	state Exp;
branches;
next	;
commitid	eWz9SBW0XqKjJlVC;


desc
@@


1.1
log
@Initial revision
@
text
@//===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "InterfaceStubs.h"
#include "CommonArgs.h"
#include "clang/Driver/Compilation.h"

namespace clang {
namespace driver {
namespace tools {
namespace ifstool {
void Merger::ConstructJob(Compilation &C, const JobAction &JA,
                          const InputInfo &Output, const InputInfoList &Inputs,
                          const llvm::opt::ArgList &Args,
                          const char *LinkingOutput) const {
  std::string Merger = getToolChain().GetProgramPath(getShortName());
  llvm::opt::ArgStringList CmdArgs;
  CmdArgs.push_back("-action");
  CmdArgs.push_back(Args.getLastArg(options::OPT_emit_merged_ifs)
                        ? "write-ifs"
                        : "write-bin");
  CmdArgs.push_back("-o");
  CmdArgs.push_back(Output.getFilename());
  for (const auto &Input : Inputs)
    CmdArgs.push_back(Input.getFilename());
  C.addCommand(std::make_unique<Command>(JA, *this, Args.MakeArgString(Merger),
                                         CmdArgs, Inputs));
}
} // namespace ifstool
} // namespace tools
} // namespace driver
} // namespace clang
@


1.1.1.1
log
@Import 01f3a59fb3e2542fce74c768718f594d0debd0da from the LLVM mono-repo:
clang (without test/, unittests/, www/)
llvm (without test/, unittests/)
@
text
@@


1.1.1.1.4.1
log
@sync with head
@
text
@a11 1
#include "llvm/Support/Path.h"
d24 3
a26 2
  const bool WriteBin = !Args.getLastArg(options::OPT_emit_merged_ifs);
  CmdArgs.push_back(WriteBin ? "write-bin" : "write-ifs");
d28 5
a32 32

  // Normally we want to write to a side-car file ending in ".ifso" so for
  // example if `clang -emit-interface-stubs -shared -o libhello.so` were
  // invoked then we would like to get libhello.so and libhello.ifso. If the
  // stdout stream is given as the output file (ie `-o -`), that is the one
  // exception where we will just append to the same filestream as the normal
  // output.
  SmallString<128> OutputFilename(Output.getFilename());
  if (OutputFilename != "-") {
    if (Args.hasArg(options::OPT_shared))
      llvm::sys::path::replace_extension(OutputFilename,
                                         (WriteBin ? "ifso" : "ifs"));
    else
      OutputFilename += (WriteBin ? ".ifso" : ".ifs");
  }

  CmdArgs.push_back(Args.MakeArgString(OutputFilename.c_str()));

  // Here we append the input files. If the input files are object files, then
  // we look for .ifs files present in the same location as the object files.
  for (const auto &Input : Inputs) {
    if (!Input.isFilename())
      continue;
    SmallString<128> InputFilename(Input.getFilename());
    if (Input.getType() == types::TY_Object)
      llvm::sys::path::replace_extension(InputFilename, ".ifs");
    CmdArgs.push_back(Args.MakeArgString(InputFilename.c_str()));
  }

  C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
                                         Args.MakeArgString(Merger), CmdArgs,
                                         Inputs, Output));
@


1.1.1.2
log
@Import clang 249b40b558955afe5ac2b549edcf2d7f859c8cc9.
@
text
@a11 1
#include "llvm/Support/Path.h"
d24 3
a26 2
  const bool WriteBin = !Args.getLastArg(options::OPT_emit_merged_ifs);
  CmdArgs.push_back(WriteBin ? "write-bin" : "write-ifs");
d28 5
a32 32

  // Normally we want to write to a side-car file ending in ".ifso" so for
  // example if `clang -emit-interface-stubs -shared -o libhello.so` were
  // invoked then we would like to get libhello.so and libhello.ifso. If the
  // stdout stream is given as the output file (ie `-o -`), that is the one
  // exception where we will just append to the same filestream as the normal
  // output.
  SmallString<128> OutputFilename(Output.getFilename());
  if (OutputFilename != "-") {
    if (Args.hasArg(options::OPT_shared))
      llvm::sys::path::replace_extension(OutputFilename,
                                         (WriteBin ? "ifso" : "ifs"));
    else
      OutputFilename += (WriteBin ? ".ifso" : ".ifs");
  }

  CmdArgs.push_back(Args.MakeArgString(OutputFilename.c_str()));

  // Here we append the input files. If the input files are object files, then
  // we look for .ifs files present in the same location as the object files.
  for (const auto &Input : Inputs) {
    if (!Input.isFilename())
      continue;
    SmallString<128> InputFilename(Input.getFilename());
    if (Input.getType() == types::TY_Object)
      llvm::sys::path::replace_extension(InputFilename, ".ifs");
    CmdArgs.push_back(Args.MakeArgString(InputFilename.c_str()));
  }

  C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
                                         Args.MakeArgString(Merger), CmdArgs,
                                         Inputs, Output));
@

