llvm.org GIT mirror llvm / 87daa91
[llvm-rtdyld] Improve error handling, use Error(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253765 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 3 years ago
1 changed file(s) with 8 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
594594 static int linkAndVerify() {
595595
596596 // Check for missing triple.
597 if (TripleName == "") {
598 llvm::errs() << "Error: -triple required when running in -verify mode.\n";
599 return 1;
600 }
597 if (TripleName == "")
598 return Error("-triple required when running in -verify mode.");
601599
602600 // Look up the target and build the disassembler.
603601 Triple TheTriple(Triple::normalize(TripleName));
604602 std::string ErrorStr;
605603 const Target *TheTarget =
606604 TargetRegistry::lookupTarget("", TheTriple, ErrorStr);
607 if (!TheTarget) {
608 llvm::errs() << "Error accessing target '" << TripleName << "': "
609 << ErrorStr << "\n";
610 return 1;
611 }
605 if (!TheTarget)
606 return Error("Error accessing target '" + TripleName + "': " + ErrorStr);
607
612608 TripleName = TheTriple.getTriple();
613609
614610 std::unique_ptr STI(
686682 Dyld.registerEHFrames();
687683
688684 int ErrorCode = checkAllExpressions(Checker);
689 if (Dyld.hasError()) {
690 errs() << "RTDyld reported an error applying relocations:\n "
691 << Dyld.getErrorString() << "\n";
692 ErrorCode = 1;
693 }
685 if (Dyld.hasError())
686 return Error("RTDyld reported an error applying relocations:\n " +
687 Dyld.getErrorString());
694688
695689 return ErrorCode;
696690 }