[llvm] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)

As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
This commit is contained in:
Simon Pilgrim 2021-10-06 12:04:30 +01:00
parent b9b90bb542
commit 21661607ca
33 changed files with 77 additions and 67 deletions

View File

@ -411,7 +411,8 @@ public:
const Elf_Shdr *getRelSection(DataRefImpl Rel) const {
auto RelSecOrErr = EF.getSection(Rel.d.a);
if (!RelSecOrErr)
report_fatal_error(errorToErrorCode(RelSecOrErr.takeError()).message());
report_fatal_error(
Twine(errorToErrorCode(RelSecOrErr.takeError()).message()));
return *RelSecOrErr;
}
@ -970,7 +971,8 @@ ELFObjectFile<ELFT>::section_rel_end(DataRefImpl Sec) const {
// Error check sh_link here so that getRelocationSymbol can just use it.
auto SymSecOrErr = EF.getSection(RelSec->sh_link);
if (!SymSecOrErr)
report_fatal_error(errorToErrorCode(SymSecOrErr.takeError()).message());
report_fatal_error(
Twine(errorToErrorCode(SymSecOrErr.takeError()).message()));
RelData.d.b += S->sh_size / S->sh_entsize;
return relocation_iterator(RelocationRef(RelData, this));
@ -1059,7 +1061,7 @@ ELFObjectFile<ELFT>::getRel(DataRefImpl Rel) const {
assert(getRelSection(Rel)->sh_type == ELF::SHT_REL);
auto Ret = EF.template getEntry<Elf_Rel>(Rel.d.a, Rel.d.b);
if (!Ret)
report_fatal_error(errorToErrorCode(Ret.takeError()).message());
report_fatal_error(Twine(errorToErrorCode(Ret.takeError()).message()));
return *Ret;
}
@ -1069,7 +1071,7 @@ ELFObjectFile<ELFT>::getRela(DataRefImpl Rela) const {
assert(getRelSection(Rela)->sh_type == ELF::SHT_RELA);
auto Ret = EF.template getEntry<Elf_Rela>(Rela.d.a, Rela.d.b);
if (!Ret)
report_fatal_error(errorToErrorCode(Ret.takeError()).message());
report_fatal_error(Twine(errorToErrorCode(Ret.takeError()).message()));
return *Ret;
}

View File

@ -71,7 +71,7 @@ bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix);
[[noreturn]] inline void ReportLastErrorFatal(const char *Msg) {
std::string ErrMsg;
MakeErrMsg(&ErrMsg, Msg);
llvm::report_fatal_error(ErrMsg);
llvm::report_fatal_error(Twine(ErrMsg));
}
template <typename HandleTraits>

View File

@ -1081,12 +1081,12 @@ void MetadataLoader::MetadataLoaderImpl::lazyLoadOneMetadata(
if (Error Err = IndexCursor.JumpToBit(
GlobalMetadataBitPosIndex[ID - MDStringRef.size()]))
report_fatal_error("lazyLoadOneMetadata failed jumping: " +
toString(std::move(Err)));
Twine(toString(std::move(Err))));
Expected<BitstreamEntry> MaybeEntry = IndexCursor.advanceSkippingSubblocks();
if (!MaybeEntry)
// FIXME this drops the error on the floor.
report_fatal_error("lazyLoadOneMetadata failed advanceSkippingSubblocks: " +
toString(MaybeEntry.takeError()));
Twine(toString(MaybeEntry.takeError())));
BitstreamEntry Entry = MaybeEntry.get();
++NumMDRecordLoaded;
if (Expected<unsigned> MaybeCode =
@ -1094,9 +1094,10 @@ void MetadataLoader::MetadataLoaderImpl::lazyLoadOneMetadata(
if (Error Err =
parseOneMetadata(Record, MaybeCode.get(), Placeholders, Blob, ID))
report_fatal_error("Can't lazyload MD, parseOneMetadata: " +
toString(std::move(Err)));
Twine(toString(std::move(Err))));
} else
report_fatal_error("Can't lazyload MD: " + toString(MaybeCode.takeError()));
report_fatal_error("Can't lazyload MD: " +
Twine(toString(MaybeCode.takeError())));
}
/// Ensure that all forward-references and placeholders are resolved.

View File

@ -117,7 +117,7 @@ static void reportTranslationError(MachineFunction &MF,
R << (" (in function: " + MF.getName() + ")").str();
if (TPC.isGlobalISelAbortEnabled())
report_fatal_error(R.getMsg());
report_fatal_error(Twine(R.getMsg()));
else
ORE.emit(R);
}

View File

@ -237,7 +237,7 @@ static void reportGISelDiagnostic(DiagnosticSeverity Severity,
R << (" (in function: " + MF.getName() + ")").str();
if (IsFatal)
report_fatal_error(R.getMsg());
report_fatal_error(Twine(R.getMsg()));
else
MORE.emit(R);
}

View File

@ -700,7 +700,7 @@ static void reportFastISelFailure(MachineFunction &MF,
R << (" (in function: " + MF.getName() + ")").str();
if (ShouldAbort)
report_fatal_error(R.getMsg());
report_fatal_error(Twine(R.getMsg()));
ORE.emit(R);
}
@ -3696,7 +3696,7 @@ void SelectionDAGISel::CannotYetSelect(SDNode *N) {
else
Msg << "unknown intrinsic #" << iid;
}
report_fatal_error(Msg.str());
report_fatal_error(Twine(Msg.str()));
}
char SelectionDAGISel::ID = 0;

View File

@ -286,7 +286,7 @@ void *RTDyldMemoryManager::getPointerToNamedFunction(const std::string &Name,
uint64_t Addr = getSymbolAddress(Name);
if (!Addr && AbortOnFailure)
report_fatal_error("Program used external function '" + Name +
report_fatal_error(Twine("Program used external function '") + Name +
"' which could not be resolved!");
return (void*)Addr;

View File

@ -680,7 +680,7 @@ unsigned RuntimeDyldImpl::computeSectionStubBufSize(const ObjectFile &Obj,
Expected<section_iterator> RelSecOrErr = SI->getRelocatedSection();
if (!RelSecOrErr)
report_fatal_error(toString(RelSecOrErr.takeError()));
report_fatal_error(Twine(toString(RelSecOrErr.takeError())));
section_iterator RelSecI = *RelSecOrErr;
if (!(RelSecI == Section))
@ -1139,7 +1139,7 @@ void RuntimeDyldImpl::applyExternalSymbolRelocations(
// FIXME: Implement error handling that doesn't kill the host program!
if (!Addr && !Resolver.allowsZeroSymbols())
report_fatal_error("Program used external function '" + Name +
report_fatal_error(Twine("Program used external function '") + Name +
"' which could not be resolved!");
// If Resolver returned UINT64_MAX, the client wants to handle this symbol

View File

@ -700,7 +700,7 @@ Error RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
Expected<section_iterator> RelSecOrErr = si->getRelocatedSection();
if (!RelSecOrErr)
report_fatal_error(toString(RelSecOrErr.takeError()));
report_fatal_error(Twine(toString(RelSecOrErr.takeError())));
section_iterator RelSecI = *RelSecOrErr;
if (RelSecI == Obj.section_end())

View File

@ -30,7 +30,7 @@ struct PassRemarksOpt {
Pattern = std::make_shared<Regex>(Val);
std::string RegexError;
if (!Pattern->isValid(RegexError))
report_fatal_error("Invalid regular expression '" + Val +
report_fatal_error(Twine("Invalid regular expression '") + Val +
"' in -pass-remarks: " + RegexError,
false);
}

View File

@ -1351,7 +1351,7 @@ void FunctionPassManager::add(Pass *P) {
///
bool FunctionPassManager::run(Function &F) {
handleAllErrors(F.materialize(), [&](ErrorInfoBase &EIB) {
report_fatal_error("Error reading bitcode file: " + EIB.message());
report_fatal_error(Twine("Error reading bitcode file: ") + EIB.message());
});
return FPM->run(F);
}

View File

@ -255,7 +255,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
// Parse a custom AA pipeline if asked to.
if (!Conf.AAPipeline.empty()) {
if (auto Err = PB.parseAAPipeline(AA, Conf.AAPipeline)) {
report_fatal_error("unable to parse AA pipeline description '" +
report_fatal_error(Twine("unable to parse AA pipeline description '") +
Conf.AAPipeline + "': " + toString(std::move(Err)));
}
} else {
@ -298,7 +298,7 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
// Parse a custom pipeline if asked to.
if (!Conf.OptPipeline.empty()) {
if (auto Err = PB.parsePassPipeline(MPM, Conf.OptPipeline)) {
report_fatal_error("unable to parse pass pipeline description '" +
report_fatal_error(Twine("unable to parse pass pipeline description '") +
Conf.OptPipeline + "': " + toString(std::move(Err)));
}
} else if (IsThinLTO) {
@ -394,8 +394,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
if (!Conf.DwoDir.empty()) {
std::error_code EC;
if (auto EC = llvm::sys::fs::create_directories(Conf.DwoDir))
report_fatal_error("Failed to create directory " + Conf.DwoDir + ": " +
EC.message());
report_fatal_error(Twine("Failed to create directory ") + Conf.DwoDir +
": " + EC.message());
DwoFile = Conf.DwoDir;
sys::path::append(DwoFile, std::to_string(Task) + ".dwo");
@ -407,7 +407,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
std::error_code EC;
DwoOut = std::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::OF_None);
if (EC)
report_fatal_error("Failed to open " + DwoFile + ": " + EC.message());
report_fatal_error(Twine("Failed to open ") + DwoFile + ": " +
EC.message());
}
auto Stream = AddStream(Task);

View File

@ -609,7 +609,7 @@ void ThinLTOCodeGenerator::addModule(StringRef Identifier, StringRef Data) {
auto InputOrError = lto::InputFile::create(Buffer);
if (!InputOrError)
report_fatal_error("ThinLTO cannot create input file: " +
report_fatal_error(Twine("ThinLTO cannot create input file: ") +
toString(InputOrError.takeError()));
auto TripleStr = (*InputOrError)->getTargetTriple();
@ -644,7 +644,7 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
const Target *TheTarget =
TargetRegistry::lookupTarget(TheTriple.str(), ErrMsg);
if (!TheTarget) {
report_fatal_error("Can't load target for this Triple: " + ErrMsg);
report_fatal_error(Twine("Can't load target for this Triple: ") + ErrMsg);
}
// Use MAttr as the default set of features.
@ -993,7 +993,7 @@ ThinLTOCodeGenerator::writeGeneratedObject(int count, StringRef CacheEntryPath,
std::error_code Err;
raw_fd_ostream OS(OutputPath, Err, sys::fs::OF_None);
if (Err)
report_fatal_error("Can't open output '" + OutputPath + "'\n");
report_fatal_error(Twine("Can't open output '") + OutputPath + "'\n");
OS << OutputBuffer.getBuffer();
return std::string(OutputPath.str());
}
@ -1014,7 +1014,7 @@ void ThinLTOCodeGenerator::run() {
bool IsDir;
sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir);
if (!IsDir)
report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'");
report_fatal_error(Twine("Unexistent dir: '") + SavedObjectsDirectoryPath + "'");
ProducedBinaryFiles.resize(Modules.size());
}

View File

@ -326,7 +326,7 @@ void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
SwitchSection(P.first, P.second);
} else {
if(Symbol->declareCommon(Size, ByteAlignment))
report_fatal_error("Symbol: " + Symbol->getName() +
report_fatal_error(Twine("Symbol: ") + Symbol->getName() +
" redeclared as different type");
}
@ -501,7 +501,7 @@ void MCELFStreamer::finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE,
*MCOffset, "BFD_RELOC_NONE", SRE, SRE->getLoc(),
*getContext().getSubtargetInfo()))
report_fatal_error("Relocation for CG Profile could not be created: " +
Err->second);
Twine(Err->second));
}
void MCELFStreamer::finalizeCGProfile() {

View File

@ -18,7 +18,7 @@ namespace object {
static int64_t getELFAddend(RelocationRef R) {
Expected<int64_t> AddendOrErr = ELFRelocationRef(R).getAddend();
handleAllErrors(AddendOrErr.takeError(), [](const ErrorInfoBase &EI) {
report_fatal_error(EI.message());
report_fatal_error(Twine(EI.message()));
});
return *AddendOrErr;
}

View File

@ -96,7 +96,7 @@ std::error_code errorToErrorCode(Error Err) {
EC = EI.convertToErrorCode();
});
if (EC == inconvertibleErrorCode())
report_fatal_error(EC.message());
report_fatal_error(Twine(EC.message()));
return EC;
}
@ -144,7 +144,7 @@ void report_fatal_error(Error Err, bool GenCrashDiag) {
raw_string_ostream ErrStream(ErrMsg);
logAllUnhandledErrors(std::move(Err), ErrStream);
}
report_fatal_error(ErrMsg);
report_fatal_error(Twine(ErrMsg));
}
} // end namespace llvm

View File

@ -93,7 +93,7 @@ SpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
std::string Error;
if (auto SCL = create(Paths, FS, Error))
return SCL;
report_fatal_error(Error);
report_fatal_error(Twine(Error));
}
bool SpecialCaseList::createInternal(const std::vector<std::string> &Paths,

View File

@ -679,7 +679,8 @@ raw_fd_ostream::~raw_fd_ostream() {
// has_error() and clear the error flag with clear_error() before
// destructing raw_ostream objects which may have errors.
if (has_error())
report_fatal_error("IO failure on output stream: " + error().message(),
report_fatal_error(Twine("IO failure on output stream: ") +
error().message(),
/*gen_crash_diag=*/false);
}

View File

@ -450,16 +450,16 @@ std::string AMDGPUTargetID::toString() const {
} else if (Processor == "gfx801") {
if (!isXnackOnOrAny())
report_fatal_error(
"AMD GPU code object V2 does not support processor " + Processor +
" without XNACK");
"AMD GPU code object V2 does not support processor " +
Twine(Processor) + " without XNACK");
} else if (Processor == "gfx802") {
} else if (Processor == "gfx803") {
} else if (Processor == "gfx805") {
} else if (Processor == "gfx810") {
if (!isXnackOnOrAny())
report_fatal_error(
"AMD GPU code object V2 does not support processor " + Processor +
" without XNACK");
"AMD GPU code object V2 does not support processor " +
Twine(Processor) + " without XNACK");
} else if (Processor == "gfx900") {
if (isXnackOnOrAny())
Processor = "gfx901";
@ -475,11 +475,12 @@ std::string AMDGPUTargetID::toString() const {
} else if (Processor == "gfx90c") {
if (isXnackOnOrAny())
report_fatal_error(
"AMD GPU code object V2 does not support processor " + Processor +
" with XNACK being ON or ANY");
"AMD GPU code object V2 does not support processor " +
Twine(Processor) + " with XNACK being ON or ANY");
} else {
report_fatal_error(
"AMD GPU code object V2 does not support processor " + Processor);
"AMD GPU code object V2 does not support processor " +
Twine(Processor));
}
break;
case ELF::ELFABIVERSION_AMDGPU_HSA_V3:

View File

@ -164,7 +164,7 @@ bool BPFMIPreEmitChecking::processAtomicInsts(void) {
DebugLoc Empty;
const DebugLoc &DL = MI.getDebugLoc();
if (DL != Empty)
report_fatal_error("line " + std::to_string(DL.getLine()) +
report_fatal_error(Twine("line ") + std::to_string(DL.getLine()) +
": Invalid usage of the XADD return value", false);
else
report_fatal_error("Invalid usage of the XADD return value", false);

View File

@ -3627,8 +3627,8 @@ int HexagonInstrInfo::getDotNewOp(const MachineInstr &MI) const {
switch (MI.getOpcode()) {
default:
report_fatal_error(std::string("Unknown .new type: ") +
std::to_string(MI.getOpcode()));
report_fatal_error(Twine("Unknown .new type: ") +
std::to_string(MI.getOpcode()));
case Hexagon::S4_storerb_ur:
return Hexagon::S4_storerbnew_ur;

View File

@ -161,7 +161,7 @@ MCSymbolWasm *WebAssemblyAsmPrinter::getMCSymbolForFunction(
"Emscripten EH/SjLj does not support multivalue returns: " +
std::string(F->getName()) + ": " +
WebAssembly::signatureToString(Sig);
report_fatal_error(Msg);
report_fatal_error(Twine(Msg));
}
WasmSym = cast<MCSymbolWasm>(
GetExternalSymbolSymbol(getEmscriptenInvokeSymbolName(Sig)));

View File

@ -306,7 +306,8 @@ bool X86LoadValueInjectionLoadHardeningPass::runOnMachineFunction(
OptimizeDL = llvm::sys::DynamicLibrary::getPermanentLibrary(
OptimizePluginPath.c_str(), &ErrorMsg);
if (!ErrorMsg.empty())
report_fatal_error("Failed to load opt plugin: \"" + ErrorMsg + '\"');
report_fatal_error(Twine("Failed to load opt plugin: \"") + ErrorMsg +
"\"");
OptimizeCut = (OptimizeCutT)OptimizeDL.getAddressOfSymbol("optimize_cut");
if (!OptimizeCut)
report_fatal_error("Invalid optimization plugin");

View File

@ -1334,7 +1334,7 @@ Expected<bool> FunctionImporter::importFunctions(
std::move(SrcModule), GlobalsToImport.getArrayRef(),
[](GlobalValue &, IRMover::ValueAdder) {},
/*IsPerformingImport=*/true))
report_fatal_error("Function Import: link error: " +
report_fatal_error(Twine("Function Import: link error: ") +
toString(std::move(Err)));
ImportedCount += GlobalsToImport.size();

View File

@ -1156,7 +1156,7 @@ void DataFlowSanitizer::addGlobalNameSuffix(GlobalValue *GV) {
Pos = Asm.find("@");
if (Pos == std::string::npos)
report_fatal_error("unsupported .symver: " + Asm);
report_fatal_error(Twine("unsupported .symver: ", Asm));
Asm.replace(Pos, 1, Suffix + "@");
GV->getParent()->setModuleInlineAsm(Asm);

View File

@ -86,7 +86,7 @@ GCOVOptions GCOVOptions::getDefault() {
Options.Atomic = AtomicCounter;
if (DefaultGCOVVersion.size() != 4) {
llvm::report_fatal_error(std::string("Invalid -default-gcov-version: ") +
llvm::report_fatal_error(Twine("Invalid -default-gcov-version: ") +
DefaultGCOVVersion);
}
memcpy(Options.Version, DefaultGCOVVersion.c_str(), 4);

View File

@ -1074,7 +1074,7 @@ void InstrProfiling::emitNameData() {
std::string CompressedNameStr;
if (Error E = collectPGOFuncNameStrings(ReferencedNames, CompressedNameStr,
DoInstrProfNameCompression)) {
report_fatal_error(toString(std::move(E)), false);
report_fatal_error(Twine(toString(std::move(E))), false);
}
auto &Ctx = M->getContext();

View File

@ -184,7 +184,7 @@ performOnModule(Module &M) {
std::string Name = Regex(Pattern).sub(Transform, C.getName(), &Error);
if (!Error.empty())
report_fatal_error("unable to transforn " + C.getName() + " in " +
report_fatal_error(Twine("unable to transforn ") + C.getName() + " in " +
M.getModuleIdentifier() + ": " + Error);
if (C.getName() == Name)
@ -256,11 +256,11 @@ bool RewriteMapParser::parse(const std::string &MapFile,
MemoryBuffer::getFile(MapFile);
if (!Mapping)
report_fatal_error("unable to read rewrite map '" + MapFile + "': " +
Mapping.getError().message());
report_fatal_error(Twine("unable to read rewrite map '") + MapFile +
"': " + Mapping.getError().message());
if (!parse(*Mapping, DL))
report_fatal_error("unable to parse rewrite map '" + MapFile + "'");
report_fatal_error(Twine("unable to parse rewrite map '") + MapFile + "'");
return true;
}

View File

@ -309,7 +309,7 @@ ExecutableFunction::ExecutableFunction(
std::make_unique<TrackingSectionMemoryManager>(&CodeSize))
.create(TM.release()));
if (!ExecEngine)
report_fatal_error(Error);
report_fatal_error(Twine(Error));
// Adding the generated object file containing the assembled function.
// The ExecutionEngine makes sure the object file is copied into an
// executable page.

View File

@ -375,7 +375,7 @@ static void printIndexStats() {
ExitOnErr(getModuleSummaryIndexForFile(Filename));
// Skip files without a module summary.
if (!Index)
report_fatal_error(Filename + " does not contain an index");
report_fatal_error(Twine(Filename) + " does not contain an index");
unsigned Calls = 0, Refs = 0, Functions = 0, Alias = 0, Globals = 0;
for (auto &Summaries : *Index) {

View File

@ -145,7 +145,7 @@ static uint64_t getSectionLMA(const ELFFile<ELFT> &Obj,
const object::ELFSectionRef &Sec) {
auto PhdrRangeOrErr = Obj.program_headers();
if (!PhdrRangeOrErr)
report_fatal_error(toString(PhdrRangeOrErr.takeError()));
report_fatal_error(Twine(toString(PhdrRangeOrErr.takeError())));
// Search for a PT_LOAD segment containing the requested section. Use this
// segment's p_addr to calculate the section's LMA.

View File

@ -426,7 +426,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
auto Ret = ELF.getSection(*Symbol, SymTab, ShndxTable);
if (!Ret)
report_fatal_error(errorToErrorCode(Ret.takeError()).message());
report_fatal_error(Twine(errorToErrorCode(Ret.takeError()).message()));
return *Ret;
}
}

View File

@ -255,7 +255,8 @@ public:
sys::Memory::MF_WRITE,
EC);
if (!MB.base())
report_fatal_error("Can't allocate enough memory: " + EC.message());
report_fatal_error(Twine("Can't allocate enough memory: ") +
EC.message());
PreallocSlab = MB;
UsePreallocation = true;
@ -312,7 +313,8 @@ uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
sys::Memory::MF_WRITE,
EC);
if (!MB.base())
report_fatal_error("MemoryManager allocation failed: " + EC.message());
report_fatal_error(Twine("MemoryManager allocation failed: ") +
EC.message());
FunctionMemory.push_back(SectionInfo(SectionName, MB, SectionID));
return (uint8_t*)MB.base();
}
@ -340,7 +342,8 @@ uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
sys::Memory::MF_WRITE,
EC);
if (!MB.base())
report_fatal_error("MemoryManager allocation failed: " + EC.message());
report_fatal_error(Twine("MemoryManager allocation failed: ") +
EC.message());
DataMemory.push_back(SectionInfo(SectionName, MB, SectionID));
return (uint8_t*)MB.base();
}
@ -395,10 +398,10 @@ static void ErrorAndExit(const Twine &Msg) {
static void loadDylibs() {
for (const std::string &Dylib : Dylibs) {
if (!sys::fs::is_regular_file(Dylib))
report_fatal_error("Dylib not found: '" + Dylib + "'.");
report_fatal_error(Twine("Dylib not found: '") + Dylib + "'.");
std::string ErrMsg;
if (sys::DynamicLibrary::LoadLibraryPermanently(Dylib.c_str(), &ErrMsg))
report_fatal_error("Error loading '" + Dylib + "': " + ErrMsg);
report_fatal_error(Twine("Error loading '") + Dylib + "': " + ErrMsg);
}
}
@ -757,15 +760,15 @@ static void remapSectionsAndSymbols(const llvm::Triple &TargetTriple,
size_t EqualsIdx = Mapping.find_first_of('=');
if (EqualsIdx == StringRef::npos)
report_fatal_error("Invalid dummy symbol specification '" + Mapping +
"'. Should be '<symbol name>=<addr>'");
report_fatal_error(Twine("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))
report_fatal_error("Invalid symbol mapping '" + Mapping + "'.");
report_fatal_error(Twine("Invalid symbol mapping '") + Mapping + "'.");
MemMgr.addDummySymbol(Symbol, Addr);
}