Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Driver/ToolChains/Clang.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 8,384 Lines • ▼ Show 20 Lines | CmdArgs.push_back( | ||||
Args.MakeArgString(Twine("-pass-remarks-analysis=") + A->getValue())); | Args.MakeArgString(Twine("-pass-remarks-analysis=") + A->getValue())); | ||||
if (Args.getLastArg(options::OPT_save_temps_EQ)) | if (Args.getLastArg(options::OPT_save_temps_EQ)) | ||||
CmdArgs.push_back("-save-temps"); | CmdArgs.push_back("-save-temps"); | ||||
// Construct the link job so we can wrap around it. | // Construct the link job so we can wrap around it. | ||||
Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput); | Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput); | ||||
const auto &LinkCommand = C.getJobs().getJobs().back(); | const auto &LinkCommand = C.getJobs().getJobs().back(); | ||||
// Forward -Xoffload-linker arguments to the device link job. | |||||
for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) | |||||
CmdArgs.push_back( | |||||
Args.MakeArgString(Twine("-device-linker=") + Arg->getValue())); | |||||
Args.ClaimAllArgs(options::OPT_Xoffload_linker); | |||||
// Add the linker arguments to be forwarded by the wrapper. | // Add the linker arguments to be forwarded by the wrapper. | ||||
CmdArgs.push_back("-linker-path"); | CmdArgs.push_back("-linker-path"); | ||||
CmdArgs.push_back(LinkCommand->getExecutable()); | CmdArgs.push_back(LinkCommand->getExecutable()); | ||||
CmdArgs.push_back("--"); | CmdArgs.push_back("--"); | ||||
for (const char *LinkArg : LinkCommand->getArguments()) | for (const char *LinkArg : LinkCommand->getArguments()) | ||||
CmdArgs.push_back(LinkArg); | CmdArgs.push_back(LinkArg); | ||||
const char *Exec = | const char *Exec = | ||||
Args.MakeArgString(getToolChain().GetProgramPath("clang-linker-wrapper")); | Args.MakeArgString(getToolChain().GetProgramPath("clang-linker-wrapper")); | ||||
// Replace the executable and arguments of the link job with the | // Replace the executable and arguments of the link job with the | ||||
// wrapper. | // wrapper. | ||||
LinkCommand->replaceExecutable(Exec); | LinkCommand->replaceExecutable(Exec); | ||||
LinkCommand->replaceArguments(CmdArgs); | LinkCommand->replaceArguments(CmdArgs); | ||||
} | } |