From: Ikhlas Ajbar Date: Sat, 9 May 2015 02:13:25 +0000 (+0000) Subject: Factor out Hexagon code to build args. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8784523886498ca60fb9c3ecfa622ea877fc3e2b;p=clang Factor out Hexagon code to build args. This patch factor out the code in hexagon::Link::ConstructJob to be reused in other functions. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236926 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 186f08e211..0be1fa1e17 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -5444,17 +5444,16 @@ void hexagon::Link::RenderExtraToolArgs(const JobAction &JA, // The types are (hopefully) good enough. } -void hexagon::Link::ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const ArgList &Args, - const char *LinkingOutput) const { +static void constructHexagonLinkArgs(Compilation &C, const JobAction &JA, + const toolchains::Hexagon_TC& ToolChain, + const InputInfo &Output, + const InputInfoList &Inputs, + const ArgList &Args, + ArgStringList &CmdArgs, + const char *LinkingOutput) { - const toolchains::Hexagon_TC& ToolChain = - static_cast(getToolChain()); const Driver &D = ToolChain.getDriver(); - ArgStringList CmdArgs; //---------------------------------------------------------------------------- // @@ -5600,6 +5599,20 @@ void hexagon::Link::ConstructJob(Compilation &C, const JobAction &JA, std::string finiObj = useShared ? "/finiS.o" : "/fini.o"; CmdArgs.push_back(Args.MakeArgString(StartFilesDir + finiObj)); } +} + +void hexagon::Link::ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, + const InputInfoList &Inputs, + const ArgList &Args, + const char *LinkingOutput) const { + + const toolchains::Hexagon_TC& ToolChain = + static_cast(getToolChain()); + + ArgStringList CmdArgs; + constructHexagonLinkArgs(C, JA, ToolChain, Output, Inputs, Args, CmdArgs, + LinkingOutput); std::string Linker = ToolChain.GetProgramPath("hexagon-ld"); C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Linker),