about summary refs log tree commit diff
path: root/src/rustllvm/ArchiveWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-01-25 12:49:01 -0600
committerAlex Crichton <alex@alexcrichton.com>2018-01-25 13:49:54 -0800
commit8a9381db01c71851654e445e7f2d81786fc80ecd (patch)
tree133465413a64b18bbe2bf90eb71bf25220dfab6d /src/rustllvm/ArchiveWrapper.cpp
parentf7706d5816b48a9dcc31b06472ecb630eab2ea44 (diff)
parente9a64996bedbc224d1edb401162d2c3cc15eb7c1 (diff)
downloadrust-8a9381db01c71851654e445e7f2d81786fc80ecd.tar.gz
rust-8a9381db01c71851654e445e7f2d81786fc80ecd.zip
Rollup merge of #47710 - alexcrichton:llvm-6-compat, r=nikomatsakis
First round of LLVM 6.0.0 compatibility

This includes a number of commits for the first round of upgrading to LLVM 6. There are still [lingering bugs](https://github.com/rust-lang/rust/issues/47683) but I believe all of this will nonetheless be necessary!
Diffstat (limited to 'src/rustllvm/ArchiveWrapper.cpp')
-rw-r--r--src/rustllvm/ArchiveWrapper.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp
index b110013ceae..93157cd6819 100644
--- a/src/rustllvm/ArchiveWrapper.cpp
+++ b/src/rustllvm/ArchiveWrapper.cpp
@@ -42,7 +42,6 @@ struct RustArchiveIterator {
 enum class LLVMRustArchiveKind {
   Other,
   GNU,
-  MIPS64,
   BSD,
   COFF,
 };
@@ -51,8 +50,6 @@ static Archive::Kind fromRust(LLVMRustArchiveKind Kind) {
   switch (Kind) {
   case LLVMRustArchiveKind::GNU:
     return Archive::K_GNU;
-  case LLVMRustArchiveKind::MIPS64:
-    return Archive::K_MIPS64;
   case LLVMRustArchiveKind::BSD:
     return Archive::K_BSD;
   case LLVMRustArchiveKind::COFF:
@@ -235,9 +232,16 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
       Members.push_back(std::move(*MOrErr));
     }
   }
-  auto Pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
-  if (!Pair.second)
+  auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
+#if LLVM_VERSION_GE(6, 0)
+  if (!Result)
     return LLVMRustResult::Success;
-  LLVMRustSetLastError(Pair.second.message().c_str());
+  LLVMRustSetLastError(toString(std::move(Result)).c_str());
+#else
+  if (!Result.second)
+    return LLVMRustResult::Success;
+  LLVMRustSetLastError(Result.second.message().c_str());
+#endif
+
   return LLVMRustResult::Failure;
 }