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.
This commit is contained in:
Augie Fackler 2021-03-16 16:32:00 -04:00
parent 0ed1c33ad9
commit dcdb9ad3d2

View file

@ -23,10 +23,17 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer(
const char* const Filenames[],
size_t FilenamesLen,
RustStringRef BufferOut) {
#if LLVM_VERSION_GE(12,0)
SmallVector<std::string,32> FilenameRefs;
for (size_t i = 0; i < FilenamesLen; i++) {
FilenameRefs.push_back(std::string(Filenames[i]));
}
#else
SmallVector<StringRef,32> 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);