summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-11-06 11:35:04 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-11-07 19:28:08 (GMT)
commitcf7e68087d005051ec07cb21c2aed2963a3d5c4e (patch)
tree67869490366e8f5b2a448100581e494f3f5d07e3 /Source/cmNinjaNormalTargetGenerator.cxx
parent5b0693411ef53349f192140b855ec1cdc148f3b9 (diff)
downloadCMake-cf7e68087d005051ec07cb21c2aed2963a3d5c4e.zip
CMake-cf7e68087d005051ec07cb21c2aed2963a3d5c4e.tar.gz
CMake-cf7e68087d005051ec07cb21c2aed2963a3d5c4e.tar.bz2
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().
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 325692e..228df7f 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -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());
-
- localGen.GetDeviceLinkFlags(linkLineComputer.get(), config,
- vars["LINK_LIBRARIES"], vars["LINK_FLAGS"],
- frameworkPath, linkPath, genTarget);
+ cmNinjaLinkLineDeviceComputer linkLineComputer(
+ this->GetLocalGenerator(),
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(), globalGen);
+ linkLineComputer.SetUseNinjaMulti(globalGen->IsMultiConfig());
+
+ localGen.GetDeviceLinkFlags(linkLineComputer, config, vars["LINK_LIBRARIES"],
+ vars["LINK_FLAGS"], frameworkPath, linkPath,
+ genTarget);
this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars);