From 20471aec03dd948b6f54ef4115f757f05505b6cd Mon Sep 17 00:00:00 2001 From: Michael Toguchi Date: Tue, 12 Nov 2024 20:50:22 -0700 Subject: [PATCH] [Driver][SYCL][NFC] Fix memory sanitizer issue for AOT (#16063) When using AOT for GPU, we will setup implied options for PVC targets. The strings that are formed need to be added to the vector to be processed later. One of these strings was a StringRef so the pointed to location can go away. Make a copy of the string to satisfy the sanitizer. --- clang/lib/Driver/ToolChains/SYCL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp b/clang/lib/Driver/ToolChains/SYCL.cpp index 7e8067f5ec2e4..1d903aa1fc17c 100644 --- a/clang/lib/Driver/ToolChains/SYCL.cpp +++ b/clang/lib/Driver/ToolChains/SYCL.cpp @@ -1889,8 +1889,8 @@ void SYCLToolChain::AddImpliedTargetArgs(const llvm::Triple &Triple, DeviceName = DevArg; StringRef BackendOptName = SYCL::gen::getGenGRFFlag("auto"); if (IsGen) - PerDeviceArgs.push_back( - {DeviceName, Args.MakeArgString(BackendOptName)}); + PerDeviceArgs.push_back({Args.MakeArgString(DeviceName), + Args.MakeArgString(BackendOptName)}); else if (IsJIT) BeArgs.push_back(Args.MakeArgString(RegAllocModeOptName + DeviceName + ":" + BackendOptName));