about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-23 09:42:22 +0000
committerbors <bors@rust-lang.org>2021-03-23 09:42:22 +0000
commit4eb0bc7346ef38218e21268001a898f6892db2c1 (patch)
treee34f0e2b13b19d90f6ad94031b40da01b766995d /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent9b6339e4b9747d473270baa42e77e1d2fff39bf4 (diff)
parent9431e8577d44dcc463134275421a6da6d862c377 (diff)
downloadrust-4eb0bc7346ef38218e21268001a898f6892db2c1.tar.gz
rust-4eb0bc7346ef38218e21268001a898f6892db2c1.zip
Auto merge of #83260 - durin42:llvm-update, r=nagisa
rustc: changes to allow an llvm update

This lets LLVM be built using 2b5f3f446f36, which is only a few weeks old. The next change in LLVM (5de2d189e6ad) breaks rustc again by removing a function that's exposed into the Rust code, but I'll file a bug about that separately.

Please scrutinize the `thinLTOResolvePrevailingInIndex` call, as I'm not at all sure an empty config is right.

I'm also suspicious that a specific alignment could be specified in the call to CreateAtomicCmpXchg, but I don't know enough to figure that out.

Thanks!
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
index e97d96e3a4e..35cca04b20f 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(13,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);