Skip to content

Commit dcdb9ad

Browse files
committed
llvm-wrapper: pass std::string instead of StringRef
LLVM change 5fbd1a3 modified this function to want std::string instead of StringRef, which is easily done.
1 parent 0ed1c33 commit dcdb9ad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer(
2323
const char* const Filenames[],
2424
size_t FilenamesLen,
2525
RustStringRef BufferOut) {
26+
#if LLVM_VERSION_GE(12,0)
27+
SmallVector<std::string,32> FilenameRefs;
28+
for (size_t i = 0; i < FilenamesLen; i++) {
29+
FilenameRefs.push_back(std::string(Filenames[i]));
30+
}
31+
#else
2632
SmallVector<StringRef,32> FilenameRefs;
2733
for (size_t i = 0; i < FilenamesLen; i++) {
2834
FilenameRefs.push_back(StringRef(Filenames[i]));
2935
}
36+
#endif
3037
auto FilenamesWriter = coverage::CoverageFilenamesSectionWriter(
3138
makeArrayRef(FilenameRefs));
3239
RawRustStringOstream OS(BufferOut);

0 commit comments

Comments
 (0)