Skip to content

Commit

Permalink
rustc_llvm: Fix flattened CLI args
Browse files Browse the repository at this point in the history
Fixes string manipulation errors introduced in #130446.
  • Loading branch information
aeubanks committed Oct 16, 2024
1 parent bed75e7 commit 6de277c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,12 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
auto Arg0 = std::string(ArgsCstrBuff);
buffer_offset = Arg0.size() + 1;
auto ArgsCppStr =
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - 1);
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - buffer_offset);
auto i = 0;
while (i != std::string::npos) {
i = ArgsCppStr.find('\0', i + 1);
if (i != std::string::npos)
ArgsCppStr.replace(i, i + 1, " ");
ArgsCppStr.replace(i, 1, " ");
}
Options.MCOptions.Argv0 = Arg0;
Options.MCOptions.CommandlineArgs = ArgsCppStr;
Expand Down

0 comments on commit 6de277c

Please sign in to comment.