rustc_llvm: Fix flattened CLI args
Fixes string manipulation errors introduced in #130446.
This commit is contained in:
parent
bed75e7c21
commit
6de277c039
1 changed files with 2 additions and 2 deletions
|
@ -491,12 +491,12 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
||||||
auto Arg0 = std::string(ArgsCstrBuff);
|
auto Arg0 = std::string(ArgsCstrBuff);
|
||||||
buffer_offset = Arg0.size() + 1;
|
buffer_offset = Arg0.size() + 1;
|
||||||
auto ArgsCppStr =
|
auto ArgsCppStr =
|
||||||
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - 1);
|
std::string(ArgsCstrBuff + buffer_offset, ArgsCstrBuffLen - buffer_offset);
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
while (i != std::string::npos) {
|
while (i != std::string::npos) {
|
||||||
i = ArgsCppStr.find('\0', i + 1);
|
i = ArgsCppStr.find('\0', i + 1);
|
||||||
if (i != std::string::npos)
|
if (i != std::string::npos)
|
||||||
ArgsCppStr.replace(i, i + 1, " ");
|
ArgsCppStr.replace(i, 1, " ");
|
||||||
}
|
}
|
||||||
Options.MCOptions.Argv0 = Arg0;
|
Options.MCOptions.Argv0 = Arg0;
|
||||||
Options.MCOptions.CommandlineArgs = ArgsCppStr;
|
Options.MCOptions.CommandlineArgs = ArgsCppStr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue