diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-11-09 05:12:46 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-11-09 05:12:46 +0000 |
| commit | 15d883e5b73ce6758926d8e3ef4a307f9ac6092f (patch) | |
| tree | 0c85c9634f6ff5ec409a9589eb9636d8a1d435b9 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | beb8d6fac180a48381e7c7c21d94ba4e1cfab1be (diff) | |
| parent | 2ac1c1868f8034dd8a8b8d4c82fd0b9abb66a0f1 (diff) | |
| download | rust-15d883e5b73ce6758926d8e3ef4a307f9ac6092f.tar.gz rust-15d883e5b73ce6758926d8e3ef4a307f9ac6092f.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 645b4082be5..a68eed03e61 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -140,26 +140,14 @@ extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M, unwrap(M)->setTargetTriple(Triple::normalize(Triple)); } -extern "C" const char *LLVMRustPrintPassTimings(size_t *Len) { - std::string buf; - auto SS = raw_string_ostream(buf); - TimerGroup::printAll(SS); - SS.flush(); - *Len = buf.length(); - char *CStr = (char *)malloc(*Len); - memcpy(CStr, buf.c_str(), *Len); - return CStr; -} - -extern "C" const char *LLVMRustPrintStatistics(size_t *Len) { - std::string buf; - auto SS = raw_string_ostream(buf); - llvm::PrintStatistics(SS); - SS.flush(); - *Len = buf.length(); - char *CStr = (char *)malloc(*Len); - memcpy(CStr, buf.c_str(), *Len); - return CStr; +extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) { + auto OS = RawRustStringOstream(OutBuf); + TimerGroup::printAll(OS); +} + +extern "C" void LLVMRustPrintStatistics(RustStringRef OutBuf) { + auto OS = RawRustStringOstream(OutBuf); + llvm::PrintStatistics(OS); } extern "C" LLVMValueRef LLVMRustGetNamedValue(LLVMModuleRef M, const char *Name, |
