Finish removal of EH usage from the Archive library. The REQUIRES_EH flag
in lib/Bytecode/Archive/Makefile is now removed. One small step closer to
a smaller LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29067 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bytecode/Archive/ArchiveWriter.cpp b/lib/Bytecode/Archive/ArchiveWriter.cpp
index 8781665..390fd12 100644
--- a/lib/Bytecode/Archive/ArchiveWriter.cpp
+++ b/lib/Bytecode/Archive/ArchiveWriter.cpp
@@ -463,7 +463,12 @@
     // compatibility with other ar(1) implementations as well as allowing the
     // archive to store both native .o and LLVM .bc files, both indexed.
     if (foreignST) {
-      writeMember(*foreignST, FinalFile, false, false, false);
+      if (!writeMember(*foreignST, FinalFile, false, false, false, error)) {
+        FinalFile.close();
+        if (TmpArchive.exists())
+          TmpArchive.eraseFromDisk();
+        return false;
+      }
     }
 
     // Put out the LLVM symbol table now.