[llvm-commits] CVS: llvm/tools/llvm-ranlib/llvm-ranlib.cpp

Reid Spencer reid at x10sys.com
Sat Feb 12 23:34:28 PST 2005



Changes in directory llvm/tools/llvm-ranlib:

llvm-ranlib.cpp updated: 1.4 -> 1.5
---
Log message:

Fix PR506: http://llvm.cs.uiuc.edu/PR506 :
* Use error returned from Archive::OpenAndLoad
* Make sure only std::string is thrown so it gets caught and printed.


---
Diffs of the changes:  (+6 -4)

 llvm-ranlib.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm/tools/llvm-ranlib/llvm-ranlib.cpp
diff -u llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.4 llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.5
--- llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.4	Thu Dec 30 11:51:57 2004
+++ llvm/tools/llvm-ranlib/llvm-ranlib.cpp	Sun Feb 13 01:34:17 2005
@@ -64,12 +64,14 @@
 
     // 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 );
 






More information about the llvm-commits mailing list