Quote embedded codeview command line arguments
The formatting of the command line arguments has been moved to the frontend in:e190d074a0
However, the Rust logic introduced inad0ecebf43
did not replicate the previous argument quoting behavior.
This commit is contained in:
parent
bf3e787891
commit
97f6e4d34b
1 changed files with 12 additions and 8 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include "llvm/Passes/StandardInstrumentations.h"
|
#include "llvm/Passes/StandardInstrumentations.h"
|
||||||
#include "llvm/Support/CBindingWrapping.h"
|
#include "llvm/Support/CBindingWrapping.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
|
#include "llvm/Support/Program.h"
|
||||||
#include "llvm/Support/TimeProfiler.h"
|
#include "llvm/Support/TimeProfiler.h"
|
||||||
#include "llvm/Support/VirtualFileSystem.h"
|
#include "llvm/Support/VirtualFileSystem.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
@ -472,16 +473,19 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
||||||
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
|
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
|
||||||
auto Arg0 = std::string(ArgsCstrBuff);
|
auto Arg0 = std::string(ArgsCstrBuff);
|
||||||
buffer_offset = Arg0.size() + 1;
|
buffer_offset = Arg0.size() + 1;
|
||||||
auto ArgsCppStr = std::string(ArgsCstrBuff + buffer_offset,
|
|
||||||
ArgsCstrBuffLen - buffer_offset);
|
std::string CommandlineArgs;
|
||||||
auto i = 0;
|
raw_string_ostream OS(CommandlineArgs);
|
||||||
while (i != std::string::npos) {
|
ListSeparator LS(" ");
|
||||||
i = ArgsCppStr.find('\0', i + 1);
|
for (StringRef Arg : split(StringRef(ArgsCstrBuff + buffer_offset,
|
||||||
if (i != std::string::npos)
|
ArgsCstrBuffLen - buffer_offset),
|
||||||
ArgsCppStr.replace(i, 1, " ");
|
'\0')) {
|
||||||
|
OS << LS;
|
||||||
|
sys::printArg(OS, Arg, /*Quote=*/true);
|
||||||
}
|
}
|
||||||
|
OS.flush();
|
||||||
Options.MCOptions.Argv0 = Arg0;
|
Options.MCOptions.Argv0 = Arg0;
|
||||||
Options.MCOptions.CommandlineArgs = ArgsCppStr;
|
Options.MCOptions.CommandlineArgs = CommandlineArgs;
|
||||||
#else
|
#else
|
||||||
int buffer_offset = 0;
|
int buffer_offset = 0;
|
||||||
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
|
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue