Skip to content

Commit

Permalink
Fix PR506:
Browse files Browse the repository at this point in the history
* 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
Reid Spencer committed Feb 13, 2005
1 parent 4dc534c commit ef11c5e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/llvm-ranlib/llvm-ranlib.cpp
Original file line number Diff line number Diff line change
@@ -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 );

0 comments on commit ef11c5e

Please sign in to comment.