[PATCH] D92371: [llvm-readobj] - Introduce `ObjDumper::reportUniqueWarning(const Twine &Msg)`.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 01:35:11 PST 2020


grimar added a comment.

In D92371#2425038 <https://reviews.llvm.org/D92371#2425038>, @jhenderson wrote:

> Looks reasonable. What cases remain that require the older version?

There are still many places where it is used.

E.g.:

  std::string SymbolName;
  if (Expected<StringRef> NameOrErr = Symbol.getName(*StrTable)) {
    SymbolName = maybeDemangle(*NameOrErr);
  } else {
    reportUniqueWarning(NameOrErr.takeError());
    return "<?>";
  }
  
  if (SymbolName.empty() && Symbol.getType() == ELF::STT_SECTION) {
    Expected<unsigned> SectionIndex = getSymbolSectionIndex(Symbol, SymIndex);
    if (!SectionIndex) {
      reportUniqueWarning(SectionIndex.takeError());
      return "<?>";
    }
    Expected<StringRef> NameOrErr = getSymbolSectionName(Symbol, *SectionIndex);
    if (!NameOrErr) {
      reportUniqueWarning(NameOrErr.takeError());
      return ("<section " + Twine(*SectionIndex) + ">").str();
    }
    return std::string(*NameOrErr);
  }

We might use `toString()` for such places or rewrite them to provide more context probably.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92371/new/

https://reviews.llvm.org/D92371



More information about the llvm-commits mailing list