diff options
author | Davide Italiano <davide@freebsd.org> | 2015-11-21 05:44:41 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2015-11-21 05:44:41 +0000 |
commit | 87daa918a16e2f8d6a7277156f91d5a933f86c73 (patch) | |
tree | b26d512424c52b281f0d95cd378acc3850c29a8b /tools | |
parent | 798892661ceca2b70e1dc751d61fd6b0da0cee8e (diff) |
[llvm-rtdyld] Improve error handling, use Error().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-rtdyld/llvm-rtdyld.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index c5f2665a5d7..689fb101f9c 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -595,21 +595,17 @@ static void remapSectionsAndSymbols(const llvm::Triple &TargetTriple, static int linkAndVerify() { // Check for missing triple. - if (TripleName == "") { - llvm::errs() << "Error: -triple required when running in -verify mode.\n"; - return 1; - } + if (TripleName == "") + return Error("-triple required when running in -verify mode."); // Look up the target and build the disassembler. Triple TheTriple(Triple::normalize(TripleName)); std::string ErrorStr; const Target *TheTarget = TargetRegistry::lookupTarget("", TheTriple, ErrorStr); - if (!TheTarget) { - llvm::errs() << "Error accessing target '" << TripleName << "': " - << ErrorStr << "\n"; - return 1; - } + if (!TheTarget) + return Error("Error accessing target '" + TripleName + "': " + ErrorStr); + TripleName = TheTriple.getTriple(); std::unique_ptr<MCSubtargetInfo> STI( @@ -687,11 +683,9 @@ static int linkAndVerify() { Dyld.registerEHFrames(); int ErrorCode = checkAllExpressions(Checker); - if (Dyld.hasError()) { - errs() << "RTDyld reported an error applying relocations:\n " - << Dyld.getErrorString() << "\n"; - ErrorCode = 1; - } + if (Dyld.hasError()) + return Error("RTDyld reported an error applying relocations:\n " + + Dyld.getErrorString()); return ErrorCode; } |