[llvm] r253759 - [llvm-rtdyld] Use report_fatal_error().
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 18:15:51 PST 2015
Author: davide
Date: Fri Nov 20 20:15:51 2015
New Revision: 253759
URL: http://llvm.org/viewvc/llvm-project?rev=253759&view=rev
Log:
[llvm-rtdyld] Use report_fatal_error().
This is a first step towards saner/uniform error reporting in llvm-rtdyld.
Modified:
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=253759&r1=253758&r2=253759&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Fri Nov 20 20:15:51 2015
@@ -463,11 +463,9 @@ applySpecificSectionMappings(RuntimeDyld
std::string SectionIDStr = Mapping.substr(0, EqualsIdx);
size_t ComaIdx = Mapping.find_first_of(",");
- if (ComaIdx == StringRef::npos) {
- errs() << "Invalid section specification '" << Mapping
- << "'. Should be '<file name>,<section name>=<addr>'\n";
- exit(1);
- }
+ if (ComaIdx == StringRef::npos)
+ report_fatal_error("Invalid section specification '" + Mapping +
+ "'. Should be '<file name>,<section name>=<addr>'");
std::string FileName = SectionIDStr.substr(0, ComaIdx);
std::string SectionName = SectionIDStr.substr(ComaIdx + 1);
@@ -477,20 +475,17 @@ applySpecificSectionMappings(RuntimeDyld
std::tie(OldAddrInt, ErrorMsg) =
Checker.getSectionAddr(FileName, SectionName, true);
- if (ErrorMsg != "") {
- errs() << ErrorMsg;
- exit(1);
- }
+ if (ErrorMsg != "")
+ report_fatal_error(ErrorMsg);
void* OldAddr = reinterpret_cast<void*>(static_cast<uintptr_t>(OldAddrInt));
std::string NewAddrStr = Mapping.substr(EqualsIdx + 1);
uint64_t NewAddr;
- if (StringRef(NewAddrStr).getAsInteger(0, NewAddr)) {
- errs() << "Invalid section address in mapping '" << Mapping << "'.\n";
- exit(1);
- }
+ if (StringRef(NewAddrStr).getAsInteger(0, NewAddr))
+ report_fatal_error("Invalid section address in mapping '" + Mapping +
+ "'.");
Checker.getRTDyld().mapSectionAddress(OldAddr, NewAddr);
SpecificMappings[OldAddr] = NewAddr;
@@ -579,20 +574,16 @@ static void remapSectionsAndSymbols(cons
for (const auto &Mapping : DummySymbolMappings) {
size_t EqualsIdx = Mapping.find_first_of("=");
- if (EqualsIdx == StringRef::npos) {
- errs() << "Invalid dummy symbol specification '" << Mapping
- << "'. Should be '<symbol name>=<addr>'\n";
- exit(1);
- }
+ if (EqualsIdx == StringRef::npos)
+ report_fatal_error("Invalid dummy symbol specification '" + Mapping +
+ "'. Should be '<symbol name>=<addr>'");
std::string Symbol = Mapping.substr(0, EqualsIdx);
std::string AddrStr = Mapping.substr(EqualsIdx + 1);
uint64_t Addr;
- if (StringRef(AddrStr).getAsInteger(0, Addr)) {
- errs() << "Invalid symbol mapping '" << Mapping << "'.\n";
- exit(1);
- }
+ if (StringRef(AddrStr).getAsInteger(0, Addr))
+ report_fatal_error("Invalid symbol mapping '" + Mapping + "'.");
MemMgr.addDummySymbol(Symbol, Addr);
}
More information about the llvm-commits
mailing list