From ff7488dc9a766f94daf54d81b03ab9160d0bfd88 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 20 Mar 2009 00:52:38 +0000 Subject: [PATCH] Driver: Add darwin::Lipo tool. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67355 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 25 ++++++++++++++++++++++++- lib/Driver/Tools.h | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 34538114a5..9ac20f9c95 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -298,7 +298,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, A->render(Args, CmdArgs); } - Args.AddAllArgs(CmdArgs, options::OPT_clang_W_Group, options::OPT_pedantic_Group); + Args.AddAllArgs(CmdArgs, options::OPT_clang_W_Group, + options::OPT_pedantic_Group); Args.AddLastArg(CmdArgs, options::OPT_w); Args.AddAllArgs(CmdArgs, options::OPT_std_EQ, options::OPT_ansi, options::OPT_trigraphs); @@ -437,3 +438,25 @@ void gcc::Link::RenderExtraToolArgs(ArgStringList &CmdArgs) const { // The types are (hopefully) good enough. } + +void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA, + Job &Dest, + const InputInfo &Output, + const InputInfoList &Inputs, + const ArgList &Args, + const char *LinkingOutput) const { + ArgStringList CmdArgs; + + CmdArgs.push_back("-create"); + assert(Output.isFilename() && "Unexpected lipo output."); + CmdArgs.push_back(Output.getFilename()); + for (InputInfoList::const_iterator + it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) { + const InputInfo &II = *it; + assert(II.isFilename() && "Unexpected lipo input."); + CmdArgs.push_back(II.getFilename()); + } + const char *Exec = + Args.MakeArgString(getToolChain().GetProgramPath(C, "lipo").c_str()); + Dest.addCommand(new Command(Exec, CmdArgs)); +} diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index a87a7baec5..40aa2084da 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -110,6 +110,24 @@ namespace gcc { }; } // end namespace gcc +namespace darwin { + class VISIBILITY_HIDDEN Lipo : public Tool { + public: + Lipo(const ToolChain &TC) : Tool("gcc::Link", TC) {} + + virtual bool acceptsPipedInput() const { return false; } + virtual bool canPipeOutput() const { return false; } + virtual bool hasIntegratedCPP() const { return false; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + Job &Dest, + const InputInfo &Output, + const InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; + }; +} + } // end namespace toolchains } // end namespace driver } // end namespace clang -- 2.40.0