diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2005-02-13 07:34:17 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2005-02-13 07:34:17 +0000 |
commit | ef11c5e64d8ef35ff833456771eeca0abcdea850 (patch) | |
tree | 2b3f1ef299ba401ffd3b0d2e110086f051c0cd11 /tools/llvm-ranlib | |
parent | 4dc534c7fe93743f28c093dde9332cdb9d8edfa3 (diff) |
Fix PR506:
* Use error returned from Archive::OpenAndLoad
* Make sure only std::string is thrown so it gets caught and printed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ranlib')
-rw-r--r-- | tools/llvm-ranlib/llvm-ranlib.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp index cc86fba953..70d5cf8abf 100644 --- a/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/tools/llvm-ranlib/llvm-ranlib.cpp @@ -64,12 +64,14 @@ int main(int argc, char **argv) { // Make sure it exists, we don't create empty archives if (!ArchivePath.exists()) - throw "Archive file does not exist"; + throw std::string("Archive file does not exist"); - std::auto_ptr<Archive> AutoArchive(Archive::OpenAndLoad(ArchivePath)); + std::string err_msg; + std::auto_ptr<Archive> + AutoArchive(Archive::OpenAndLoad(ArchivePath,&err_msg)); Archive* TheArchive = AutoArchive.get(); - - assert(TheArchive && "Unable to instantiate the archive"); + if (!TheArchive) + throw err_msg; TheArchive->writeToDisk(true, false, false ); |