Skip to content

Commit 6de277c

Browse files
committed
rustc_llvm: Fix flattened CLI args
Fixes string manipulation errors introduced in rust-lang#130446.
1 parent bed75e7 commit 6de277c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,12 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
491491
auto Arg0 = std::string(ArgsCstrBuff);
492492
buffer_offset = Arg0.size() + 1;
493493
auto ArgsCppStr =
494-
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - 1);
494+
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - buffer_offset);
495495
auto i = 0;
496496
while (i != std::string::npos) {
497497
i = ArgsCppStr.find('\0', i + 1);
498498
if (i != std::string::npos)
499-
ArgsCppStr.replace(i, i + 1, " ");
499+
ArgsCppStr.replace(i, 1, " ");
500500
}
501501
Options.MCOptions.Argv0 = Arg0;
502502
Options.MCOptions.CommandlineArgs = ArgsCppStr;

0 commit comments

Comments
 (0)