Skip to content

Commit dfd37f2

Browse files
committed
Cleanup ELFDumper.cpp
1 parent 54b2004 commit dfd37f2

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,27 +5331,22 @@ getCallGraphSection(const object::ELFObjectFile<ELFT> &ObjF) {
53315331

53325332
template <class ELFT> bool ELFDumper<ELFT>::processCallGraphSection() {
53335333
const Elf_Shdr *CGSection = findSectionByName(".llvm.callgraph");
5334-
if (!CGSection) {
5335-
Error NoSectionErr = createError("No .llvm.callgraph section found.");
5336-
reportError(std::move(NoSectionErr), "Missing section");
5337-
}
5334+
if (!CGSection)
5335+
reportError(createError("No .llvm.callgraph section found."),
5336+
"Missing section");
53385337

53395338
Expected<ArrayRef<uint8_t>> SectionBytesOrErr =
53405339
Obj.getSectionContents(*CGSection);
53415340
if (!SectionBytesOrErr) {
5342-
Error SectionReadErr = SectionBytesOrErr.takeError();
5343-
reportError(std::move(SectionReadErr),
5341+
reportError(SectionBytesOrErr.takeError(),
53445342
"Unable to read the .llvm.callgraph section");
53455343
}
53465344

53475345
auto PrintMalformedError = [&](Error &E, Twine FuncPC, StringRef Component) {
5348-
// auto Msg = llvm::Twine("Malformed callgraph section while reading [") +
5349-
// Component + llvm::Twine("] .\n");
5350-
std::string Msg =
5351-
(StringRef("While reading call graph info's [") + Component +
5352-
StringRef("] for function at [0x") + StringRef(FuncPC.str()) + "]")
5353-
.str();
5354-
reportError(std::move(E), StringRef(Msg));
5346+
reportError(std::move(E),
5347+
Twine("While reading call graph info's [" + Component +
5348+
"] for function at [0x" + FuncPC + "]")
5349+
.str());
53555350
};
53565351

53575352
DataExtractor Data(SectionBytesOrErr.get(), Obj.isLE(),
@@ -5367,21 +5362,22 @@ template <class ELFT> bool ELFDumper<ELFT>::processCallGraphSection() {
53675362
"While reading call graph info FormatVersionNumber");
53685363

53695364
if (FormatVersionNumber != 0) {
5370-
Error FormatErr = createError("Unknown format version value [" +
5371-
std::to_string(FormatVersionNumber) +
5372-
"] in .llvm.callgraph section.");
5373-
reportError(std::move(FormatErr), "Unknown value");
5365+
reportError(createError("Unknown format version value [" +
5366+
std::to_string(FormatVersionNumber) +
5367+
"] in .llvm.callgraph section."),
5368+
"Unknown value");
53745369
}
53755370

53765371
uint8_t Flags = Data.getU8(&Offset, &CGSectionErr);
53775372
if (CGSectionErr)
53785373
reportError(std::move(CGSectionErr),
53795374
"While reading call graph info's Flags");
53805375
if (Flags > 7) {
5381-
Error FlagsErr = createError(
5382-
"Unknown Flags. Expected a value in the range [0-7] but found [" +
5383-
std::to_string(Flags) + "]");
5384-
reportError(std::move(FlagsErr), "While reading call graph info's Flags");
5376+
reportError(
5377+
createError(
5378+
"Unknown Flags. Expected a value in the range [0-7] but found [" +
5379+
std::to_string(Flags) + "]"),
5380+
"While reading call graph info's Flags");
53855381
}
53865382
uint64_t FuncAddrOffset = Offset;
53875383
typename ELFT::uint FuncAddr =

0 commit comments

Comments
 (0)