diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-07-24 17:27:29 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-08-04 10:48:05 +1000 |
| commit | e1841186834fa53abccacc8742025986bfaf5f9e (patch) | |
| tree | 0869dba27f40821dafe38daeeb14711b33b48587 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 474709a9a2a74a8bcf0055fadb335d0ca0d2d939 (diff) | |
| download | rust-e1841186834fa53abccacc8742025986bfaf5f9e.tar.gz rust-e1841186834fa53abccacc8742025986bfaf5f9e.zip | |
coverage: Don't convert filenames to `CString` for FFI
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index 80b6c0fb439..b88e1a2b778 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -103,12 +103,20 @@ fromRust(LLVMRustCounterExprKind Kind) { } extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer( - const char* const Filenames[], + const char *const Filenames[], size_t FilenamesLen, + const size_t *const Lengths, + size_t LengthsLen, RustStringRef BufferOut) { + if (FilenamesLen != LengthsLen) { + report_fatal_error( + "Mismatched lengths in LLVMRustCoverageWriteFilenamesSectionToBuffer"); + } + SmallVector<std::string,32> FilenameRefs; + FilenameRefs.reserve(FilenamesLen); for (size_t i = 0; i < FilenamesLen; i++) { - FilenameRefs.push_back(std::string(Filenames[i])); + FilenameRefs.emplace_back(Filenames[i], Lengths[i]); } auto FilenamesWriter = coverage::CoverageFilenamesSectionWriter(ArrayRef<std::string>(FilenameRefs)); |
