From dcdb9ad3d27aca6185af64f2e0318ed47860c6c0 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Tue, 16 Mar 2021 16:32:00 -0400 Subject: llvm-wrapper: pass std::string instead of StringRef LLVM change 5fbd1a333aa1a0b70903d036b98ea56c51ae5224 modified this function to want std::string instead of StringRef, which is easily done. --- compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp') diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index e97d96e3a4e..67074685cf6 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -23,10 +23,17 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer( const char* const Filenames[], size_t FilenamesLen, RustStringRef BufferOut) { +#if LLVM_VERSION_GE(12,0) + SmallVector FilenameRefs; + for (size_t i = 0; i < FilenamesLen; i++) { + FilenameRefs.push_back(std::string(Filenames[i])); + } +#else SmallVector FilenameRefs; for (size_t i = 0; i < FilenamesLen; i++) { FilenameRefs.push_back(StringRef(Filenames[i])); } +#endif auto FilenamesWriter = coverage::CoverageFilenamesSectionWriter( makeArrayRef(FilenameRefs)); RawRustStringOstream OS(BufferOut); -- cgit 1.4.1-3-g733a5