From: Chris Lattner Date: Wed, 15 Dec 2004 07:44:15 +0000 (+0000) Subject: Do not fail an assertion on a broken archive X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=67c3821ea002aea0c3be9286d1779cf67fc03451;p=oota-llvm.git 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 --- 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.