[PATCH] D123215: [dsymutil] Fix a few TODOs about reporting errors to the user
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 06:27:51 PDT 2022
thakis created this revision.
thakis added reviewers: enderby, JDevlieghere.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.
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.
https://reviews.llvm.org/D123215
Files:
llvm/tools/dsymutil/MachODebugMapParser.cpp
Index: llvm/tools/dsymutil/MachODebugMapParser.cpp
===================================================================
--- llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -496,8 +496,9 @@
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
@@ -550,8 +551,9 @@
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;
@@ -570,8 +572,9 @@
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;
@@ -580,8 +583,9 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123215.420822.patch
Type: text/x-patch
Size: 2071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220406/bb3351fe/attachment.bin>
More information about the llvm-commits
mailing list