From 67c3821ea002aea0c3be9286d1779cf67fc03451 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 15 Dec 2004 07:44:15 +0000 Subject: [PATCH] Do not fail an assertion on a broken archive git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18959 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-ar/llvm-ar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 8f90de7bdea..586639bd631 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -677,7 +677,12 @@ int main(int argc, char **argv) { std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n"; TheArchive = Archive::CreateEmpty(ArchivePath); } else { - TheArchive = Archive::OpenAndLoad(ArchivePath); + std::string Error; + TheArchive = Archive::OpenAndLoad(ArchivePath, &Error); + if (TheArchive == 0) + std::cerr << argv[0] << ": error loading '" << ArchivePath << "': " + << Error << "!\n"; + return 1; } // Make sure we're not fooling ourselves.