diff options
| author | bors <bors@rust-lang.org> | 2025-02-17 14:19:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-17 14:19:33 +0000 |
| commit | ce36a966c79e109dabeef7a47fe68e5294c6d71e (patch) | |
| tree | 7760b470526d9297417f7511d817742b57be4c61 /compiler | |
| parent | 2162e9d4b18525e4eb542fed9985921276512d7c (diff) | |
| parent | 1873bd37201f1b9086fddab7a1a9b0acded7f10f (diff) | |
| download | rust-ce36a966c79e109dabeef7a47fe68e5294c6d71e.tar.gz rust-ce36a966c79e109dabeef7a47fe68e5294c6d71e.zip | |
Auto merge of #135763 - nikic:llvm-20, r=cuviper
Update to LLVM 20 LLVM 20 GA is scheduled for March 11th. Rust 1.87 will be stable on May 15th. * [x] https://github.com/rust-lang/rust/pull/135764 * [x] https://github.com/rust-lang/rust/pull/136134 * [x] https://github.com/rust-lang/compiler-builtins/pull/752 * [x] https://github.com/llvm/llvm-project/pull/125287 * [x] https://github.com/rust-lang/rust/pull/136537 * [x] https://github.com/rust-lang/rust/pull/136895 * [x] Wait for beta branch (Feb 14). Tested: host-x86_64, host-aarch64, apple, mingw, msvc
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index a6b2384f2d7..7eb11f9e608 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -22,6 +22,7 @@ #include "llvm/Passes/StandardInstrumentations.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Program.h" #include "llvm/Support/TimeProfiler.h" #include "llvm/Support/VirtualFileSystem.h" #include "llvm/Target/TargetMachine.h" @@ -472,16 +473,19 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0'); auto Arg0 = std::string(ArgsCstrBuff); buffer_offset = Arg0.size() + 1; - auto ArgsCppStr = 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, 1, " "); + + std::string CommandlineArgs; + raw_string_ostream OS(CommandlineArgs); + ListSeparator LS(" "); + for (StringRef Arg : split(StringRef(ArgsCstrBuff + buffer_offset, + ArgsCstrBuffLen - buffer_offset), + '\0')) { + OS << LS; + sys::printArg(OS, Arg, /*Quote=*/true); } + OS.flush(); Options.MCOptions.Argv0 = Arg0; - Options.MCOptions.CommandlineArgs = ArgsCppStr; + Options.MCOptions.CommandlineArgs = CommandlineArgs; #else int buffer_offset = 0; assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0'); |
