diff options
Diffstat (limited to 'tools/llvm-ranlib')
-rw-r--r-- | tools/llvm-ranlib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tools/llvm-ranlib/Makefile | 1 | ||||
-rw-r--r-- | tools/llvm-ranlib/llvm-ranlib.cpp | 59 |
3 files changed, 28 insertions, 33 deletions
diff --git a/tools/llvm-ranlib/CMakeLists.txt b/tools/llvm-ranlib/CMakeLists.txt index 3116d2e..2d7defe 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 36195f4..cca9501 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 4006765..d2f5f0f 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; } |