CUDA: Avoid unnecessary allocation and GetLinkLanguage()

There's no reason to allocate the cmNinjaLinkLineDeviceComputer on the heap.
We can also assume the link language as CUDA in cmLocalGenerator::GetDeviceLinkFlags().
This commit is contained in:
Raul Tambre
2021-11-06 13:35:04 +02:00
parent 5b0693411e
commit cf7e68087d
3 changed files with 11 additions and 15 deletions
+7 -9
View File
@@ -855,16 +855,14 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(output, cmOutputConverter::SHELL);
std::unique_ptr<cmLinkLineComputer> linkLineComputer(
new cmNinjaLinkLineDeviceComputer(
this->GetLocalGenerator(),
this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(),
globalGen));
linkLineComputer->SetUseNinjaMulti(globalGen->IsMultiConfig());
cmNinjaLinkLineDeviceComputer linkLineComputer(
this->GetLocalGenerator(),
this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(), globalGen);
linkLineComputer.SetUseNinjaMulti(globalGen->IsMultiConfig());
localGen.GetDeviceLinkFlags(linkLineComputer.get(), config,
vars["LINK_LIBRARIES"], vars["LINK_FLAGS"],
frameworkPath, linkPath, genTarget);
localGen.GetDeviceLinkFlags(linkLineComputer, config, vars["LINK_LIBRARIES"],
vars["LINK_FLAGS"], frameworkPath, linkPath,
genTarget);
this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars);