Driver: Add darwin::Lipo tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67355 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 3453811..9ac20f9 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -298,7 +298,8 @@
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 @@
// 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 a87a7ba..40aa208 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -110,6 +110,24 @@
};
} // 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