[clang] 9bdeab1 - [LinkerWrapper][Obvious] Fix dangling stringref on Xcuda-ptxas options
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 25 08:42:46 PDT 2023
Author: Joseph Huber
Date: 2023-10-25T10:42:34-05:00
New Revision: 9bdeab1e7b25240d9282dbdc3617aaade195d62e
URL: https://github.com/llvm/llvm-project/commit/9bdeab1e7b25240d9282dbdc3617aaade195d62e
DIFF: https://github.com/llvm/llvm-project/commit/9bdeab1e7b25240d9282dbdc3617aaade195d62e.diff
LOG: [LinkerWrapper][Obvious] Fix dangling stringref on Xcuda-ptxas options
Summary:
This accidentally was a dangling reference and caused issues when
actually used. Make sure that the memory is saved before the job is
created.
Added:
Modified:
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index f95b0f8cb317c75..1c269ce890b3b71 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -423,8 +423,9 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
CmdArgs.push_back(Args.MakeArgString("--cuda-path=" + CudaBinaryPath));
for (StringRef Arg : Args.getAllArgValues(OPT_ptxas_arg))
- llvm::copy(SmallVector<StringRef>({"-Xcuda-ptxas", Arg}),
- std::back_inserter(CmdArgs));
+ llvm::copy(
+ SmallVector<StringRef>({"-Xcuda-ptxas", Args.MakeArgString(Arg)}),
+ std::back_inserter(CmdArgs));
for (StringRef Arg : Args.getAllArgValues(OPT_linker_arg_EQ))
CmdArgs.push_back(Args.MakeArgString("-Wl," + Arg));
More information about the cfe-commits
mailing list