Skip to content

Commit

Permalink
[LinkerWrapper][Obvious] Fix dangling stringref on Xcuda-ptxas options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhuber6 committed Oct 25, 2023
1 parent 8c8336f commit 9bdeab1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 9bdeab1

Please sign in to comment.