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 | 9f219c79aa145ed0b16f44e6b4486b4928083a71 (patch) | |
tree | d6fc5a44b70ef1a0920b88c38cd45d29a0e0271c /llvm/tools/llvm-ranlib/llvm-ranlib.cpp | |
parent | 7b0fbe7ccf7e59dbc04cb0d2a7b16abb183c5d67 (diff) | |
download | bcm5719-llvm-9f219c79aa145ed0b16f44e6b4486b4928083a71.tar.gz bcm5719-llvm-9f219c79aa145ed0b16f44e6b4486b4928083a71.zip |
Fix PR506:
* Use error returned from Archive::OpenAndLoad
* Make sure only std::string is thrown so it gets caught and printed.
llvm-svn: 20147
Diffstat (limited to 'llvm/tools/llvm-ranlib/llvm-ranlib.cpp')
-rw-r--r-- | llvm/tools/llvm-ranlib/llvm-ranlib.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/tools/llvm-ranlib/llvm-ranlib.cpp b/llvm/tools/llvm-ranlib/llvm-ranlib.cpp index cc86fba953d..70d5cf8abf9 100644 --- a/llvm/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/llvm/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 ); |