summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar/llvm-ar.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-08-23 00:39:35 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-08-23 00:39:35 +0000
commit8db844241b25c5a350d3edeeac459fca69c7ae51 (patch)
treef207ee659a6aa42169484ebf0fd20b313c5e8b54 /llvm/tools/llvm-ar/llvm-ar.cpp
parent3376c6d8c572d25b87670cd44e00e018a27b37b3 (diff)
downloadbcm5719-llvm-8db844241b25c5a350d3edeeac459fca69c7ae51.tar.gz
bcm5719-llvm-8db844241b25c5a350d3edeeac459fca69c7ae51.zip
For PR797:
Remove exceptions from the Path::create*OnDisk methods. Update their users to handle error messages via arguments and result codes. llvm-svn: 29840
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
-rw-r--r--llvm/tools/llvm-ar/llvm-ar.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index d2d8c85e27f..e5abea4f904 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -425,8 +425,8 @@ void doDisplayTable() {
}
// doExtract - Implement the 'x' operation. This function extracts files back to
-// the file system, making sure to uncompress any that were compressed.
-void doExtract() {
+// the file system, making sure to uncompress any that were compressed
+bool doExtract(std::string* ErrMsg) {
buildPaths(false);
unsigned countDown = Count;
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
@@ -438,7 +438,8 @@ void doExtract() {
if (I->hasPath()) {
sys::Path dirs(I->getPath());
dirs.eraseComponent();
- dirs.createDirectoryOnDisk(/*create_parents=*/true);
+ if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg))
+ return true;
}
// Open up a file stream for writing
@@ -464,6 +465,7 @@ void doExtract() {
I->getPath().setStatusInfoOnDisk(I->getFileStatus());
}
}
+ return false;
}
// doDelete - Implement the delete operation. This function deletes zero or more
@@ -711,6 +713,7 @@ int main(int argc, char **argv) {
std::auto_ptr<Archive> AutoArchive(TheArchive);
// Perform the operation
+ std::string ErrMsg;
switch (Operation) {
case Print: doPrint(); break;
case Delete: doDelete(); break;
@@ -718,7 +721,12 @@ int main(int argc, char **argv) {
case QuickAppend: /* FALL THROUGH */
case ReplaceOrInsert: doReplaceOrInsert(); break;
case DisplayTable: doDisplayTable(); break;
- case Extract: doExtract(); break;
+ case Extract:
+ if (doExtract(&ErrMsg)) {
+ std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ return 1;
+ }
+ break;
case NoOperation:
std::cerr << argv[0] << ": No operation was selected.\n";
break;
OpenPOWER on IntegriCloud