[lld] [lld][ELF] Add --debug-names to create merged .debug_names. (PR #86508)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 08:54:09 PDT 2024
================
@@ -2782,83 +2866,23 @@ void DebugNamesBaseSection::parseDebugNames(
ne.hashValue = caseFoldingDjbHash(name);
// Read a series of index entries that end with abbreviation code 0.
- const char *errMsg = nullptr;
+ std::string errMsg;
uint64_t offset = locs.EntriesBase + entryOffsets[i];
while (offset < namesSec.Data.size() && namesSec.Data[offset] != 0) {
// Read & store all entries (for the same string).
- auto ie = makeThreadLocal<IndexEntry>();
- ie->poolOffset = offset;
- Error err = Error::success();
- ie->abbrevCode =
- static_cast<uint32_t>(namesExtractor.getULEB128(&offset, &err));
- if (err) {
- consumeError(std::move(err));
- errMsg = ": invalid abbrev code in entry";
- break;
+ Expected<IndexEntry *> ieOrErr =
+ readEntry(offset, ni, locs.EntriesBase, namesExtractor, namesSec);
+ if (!ieOrErr) {
+ errorOrWarn(toString(namesSec.sec) +
+ Twine(toString(ieOrErr.takeError())));
----------------
dwblaikie wrote:
Consider removing the ": " from the error messages inside `readEntry` (they don't need to know they're being concatenated with something else later) and adding it here instead:
```
errorOrWarn(toString(namesSec.sec) + ": " + toString(ieOrErr.takeError()));
```
https://github.com/llvm/llvm-project/pull/86508
More information about the llvm-commits
mailing list