summaryrefslogtreecommitdiff
path: root/tools/llvm-ranlib
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2012-10-26 10:49:15 +0000
committerJoerg Sonnenberger <joerg@bec.de>2012-10-26 10:49:15 +0000
commit975bc072ae1d4502d0dc7ca0d218a18574108ee6 (patch)
treecc3113016f59defebbbfc0e465207d1040d6b9a0 /tools/llvm-ranlib
parent0bd10f2af37e694f08f41199f4c6792c494430d9 (diff)
downloadllvm-975bc072ae1d4502d0dc7ca0d218a18574108ee6.tar.gz
llvm-975bc072ae1d4502d0dc7ca0d218a18574108ee6.tar.bz2
llvm-975bc072ae1d4502d0dc7ca0d218a18574108ee6.tar.xz
Adjust llvm-ar and llvm-ranlib to not depend on exception handling.
Always use an exit code of 1, but print the help message if useful. Remove the exception handling tag in llvm-as, llvm-dis and llvm-bcanalyzer, where it isn't used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ranlib')
-rw-r--r--tools/llvm-ranlib/CMakeLists.txt1
-rw-r--r--tools/llvm-ranlib/Makefile1
-rw-r--r--tools/llvm-ranlib/llvm-ranlib.cpp59
3 files changed, 28 insertions, 33 deletions
diff --git a/tools/llvm-ranlib/CMakeLists.txt b/tools/llvm-ranlib/CMakeLists.txt
index 3116d2e4ff..2d7defee11 100644
--- a/tools/llvm-ranlib/CMakeLists.txt
+++ b/tools/llvm-ranlib/CMakeLists.txt
@@ -1,5 +1,4 @@
set(LLVM_LINK_COMPONENTS archive)
-set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-ranlib
llvm-ranlib.cpp
diff --git a/tools/llvm-ranlib/Makefile b/tools/llvm-ranlib/Makefile
index 36195f4399..cca95013f4 100644
--- a/tools/llvm-ranlib/Makefile
+++ b/tools/llvm-ranlib/Makefile
@@ -10,7 +10,6 @@
LEVEL := ../..
TOOLNAME := llvm-ranlib
LINK_COMPONENTS := archive
-REQUIRES_EH := 1
# This tool has no plugins, optimize startup time.
TOOL_NO_EXPORTS := 1
diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp
index 4006765a9c..d2f5f0fff9 100644
--- a/tools/llvm-ranlib/llvm-ranlib.cpp
+++ b/tools/llvm-ranlib/llvm-ranlib.cpp
@@ -61,41 +61,38 @@ int main(int argc, char **argv) {
int exitCode = 0;
- // Make sure we don't exit with "unhandled exception".
- try {
-
- // Check the path name of the archive
- sys::Path ArchivePath;
- if (!ArchivePath.set(ArchiveName))
- throw std::string("Archive name invalid: ") + ArchiveName;
+ // Check the path name of the archive
+ sys::Path ArchivePath;
+ if (!ArchivePath.set(ArchiveName)) {
+ errs() << argv[0] << ": " << "Archive name invalid: " << ArchiveName <<
+ "\n";
+ return 1;
+ }
- // Make sure it exists, we don't create empty archives
- bool Exists;
- if (llvm::sys::fs::exists(ArchivePath.str(), Exists) || !Exists)
- throw std::string("Archive file does not exist");
+ // Make sure it exists, we don't create empty archives
+ bool Exists;
+ if (llvm::sys::fs::exists(ArchivePath.str(), Exists) || !Exists) {
+ errs() << argv[0] << ": " << "Archive file does not exist" <<
+ ArchivePath.str() << "\n";
+ return 1;
+ }
- std::string err_msg;
- std::auto_ptr<Archive>
- AutoArchive(Archive::OpenAndLoad(ArchivePath, Context, &err_msg));
- Archive* TheArchive = AutoArchive.get();
- if (!TheArchive)
- throw err_msg;
+ std::string err_msg;
+ std::auto_ptr<Archive>
+ AutoArchive(Archive::OpenAndLoad(ArchivePath, Context, &err_msg));
+ Archive* TheArchive = AutoArchive.get();
+ if (!TheArchive) {
+ errs() << argv[0] << ": " << err_msg << "\n";
+ return 1;
+ }
- if (TheArchive->writeToDisk(true, false, &err_msg ))
- throw err_msg;
+ if (TheArchive->writeToDisk(true, false, &err_msg )) {
+ errs() << argv[0] << ": " << err_msg << "\n";
+ return 1;
+ }
- if (Verbose)
- printSymbolTable(TheArchive);
+ if (Verbose)
+ printSymbolTable(TheArchive);
- } catch (const char* msg) {
- errs() << argv[0] << ": " << msg << "\n\n";
- exitCode = 1;
- } catch (const std::string& msg) {
- errs() << argv[0] << ": " << msg << "\n";
- exitCode = 2;
- } catch (...) {
- errs() << argv[0] << ": An unexpected unknown exception occurred.\n";
- exitCode = 3;
- }
return exitCode;
}