[llvm] d0141ef - [dsymutil] Fix a few TODOs about reporting errors to the user
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 09:41:33 PDT 2022
Author: Nico Weber
Date: 2022-04-06T12:41:02-04:00
New Revision: d0141ef232dfc2ae9602d1fcdf41e0209826d899
URL: https://github.com/llvm/llvm-project/commit/d0141ef232dfc2ae9602d1fcdf41e0209826d899
DIFF: https://github.com/llvm/llvm-project/commit/d0141ef232dfc2ae9602d1fcdf41e0209826d899.diff
LOG: [dsymutil] Fix a few TODOs about reporting errors to the user
I saw the TODOs while reading this file and figured I'd do them.
I haven't seen these happen in practice.
No expected behavior change.
Differential Revision: https://reviews.llvm.org/D123215
Added:
Modified:
llvm/tools/dsymutil/MachODebugMapParser.cpp
Removed:
################################################################################
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index c617d04cf1847..955272b72f566 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -518,8 +518,9 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols(
uint64_t Addr = cantFail(Sym.getValue());
Expected<StringRef> Name = Sym.getName();
if (!Name) {
- // TODO: Actually report errors helpfully.
- consumeError(Name.takeError());
+ auto Err = Name.takeError();
+ Warning("failed to get symbol name: " + toString(std::move(Err)),
+ Obj.getFileName());
continue;
}
// The value of some categories of symbols isn't meaningful. For
@@ -572,8 +573,9 @@ void MachODebugMapParser::loadMainBinarySymbols(
for (const auto &Sym : MainBinary.symbols()) {
Expected<SymbolRef::Type> TypeOrErr = Sym.getType();
if (!TypeOrErr) {
- // TODO: Actually report errors helpfully.
- consumeError(TypeOrErr.takeError());
+ auto Err = TypeOrErr.takeError();
+ Warning("failed to get symbol type: " + toString(std::move(Err)),
+ MainBinary.getFileName());
continue;
}
SymbolRef::Type Type = *TypeOrErr;
@@ -592,8 +594,9 @@ void MachODebugMapParser::loadMainBinarySymbols(
bool Extern = SymType & (MachO::N_EXT | MachO::N_PEXT);
Expected<section_iterator> SectionOrErr = Sym.getSection();
if (!SectionOrErr) {
- // TODO: Actually report errors helpfully.
- consumeError(SectionOrErr.takeError());
+ auto Err = TypeOrErr.takeError();
+ Warning("failed to get symbol section: " + toString(std::move(Err)),
+ MainBinary.getFileName());
continue;
}
Section = *SectionOrErr;
@@ -602,8 +605,9 @@ void MachODebugMapParser::loadMainBinarySymbols(
uint64_t Addr = cantFail(Sym.getValue());
Expected<StringRef> NameOrErr = Sym.getName();
if (!NameOrErr) {
- // TODO: Actually report errors helpfully.
- consumeError(NameOrErr.takeError());
+ auto Err = NameOrErr.takeError();
+ Warning("failed to get symbol name: " + toString(std::move(Err)),
+ MainBinary.getFileName());
continue;
}
StringRef Name = *NameOrErr;
More information about the llvm-commits
mailing list