Skip to content

Commit 04f9d9e

Browse files
committed
Address review comments.
1 parent 2fb856d commit 04f9d9e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,13 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
468468
/// index for an entry that is a type unit.
469469
std::optional<uint64_t> getRelatedCUIndex() const;
470470

471-
/// Returns the Index into the Local Type Unit list of the owning Name
471+
/// Returns the index of the Type Unit of the owning
472+
/// Name
472473
/// Index or std::nullopt if this Accelerator Entry does not have an
473474
/// associated Type Unit. It is up to the user to verify that the
474-
/// returned Index is valid in the owning NameIndex (or use
475+
/// returned Index is a valid index in the owning NameIndex (or use
475476
/// getLocalTUOffset(), which will handle that check itself).
476-
std::optional<uint64_t> getLocalTUIndex() const;
477+
std::optional<uint64_t> getTUIndex() const;
477478

478479
/// .debug_names-specific getter, which always succeeds (DWARF v5 index
479480
/// entries always have a tag).

llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,15 @@ std::optional<uint64_t> DWARFDebugNames::Entry::getRelatedCUOffset() const {
665665
}
666666

667667
std::optional<uint64_t> DWARFDebugNames::Entry::getLocalTUOffset() const {
668-
std::optional<uint64_t> Index = getLocalTUIndex();
668+
std::optional<uint64_t> Index = getTUIndex();
669669
if (!Index || *Index >= NameIdx->getLocalTUCount())
670670
return std::nullopt;
671671
return NameIdx->getLocalTUOffset(*Index);
672672
}
673673

674674
std::optional<uint64_t>
675675
DWARFDebugNames::Entry::getForeignTUTypeSignature() const {
676-
std::optional<uint64_t> Index = getLocalTUIndex();
676+
std::optional<uint64_t> Index = getTUIndex();
677677
const uint32_t NumLocalTUs = NameIdx->getLocalTUCount();
678678
if (!Index || *Index < NumLocalTUs)
679679
return std::nullopt; // Invalid TU index or TU index is for a local TU
@@ -684,7 +684,7 @@ DWARFDebugNames::Entry::getForeignTUTypeSignature() const {
684684
return NameIdx->getForeignTUSignature(ForeignTUIndex);
685685
}
686686

687-
std::optional<uint64_t> DWARFDebugNames::Entry::getLocalTUIndex() const {
687+
std::optional<uint64_t> DWARFDebugNames::Entry::getTUIndex() const {
688688
if (std::optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_type_unit))
689689
return Off->getAsUnsignedConstant();
690690
return std::nullopt;

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ unsigned DWARFVerifier::verifyNameIndexEntries(
15871587
EntryOr = NI.getEntry(&NextEntryID)) {
15881588

15891589
std::optional<uint64_t> CUIndex = EntryOr->getRelatedCUIndex();
1590-
std::optional<uint64_t> TUIndex = EntryOr->getLocalTUIndex();
1590+
std::optional<uint64_t> TUIndex = EntryOr->getTUIndex();
15911591
if (CUIndex && *CUIndex >= NI.getCUCount()) {
15921592
ErrorCategory.Report("Name Index entry contains invalid CU index", [&]() {
15931593
error() << formatv("Name Index @ {0:x}: Entry @ {1:x} contains an "
@@ -1677,7 +1677,7 @@ unsigned DWARFVerifier::verifyNameIndexEntries(
16771677
DWARFUnit *NonSkeletonUnit = nullptr;
16781678
if (TUIndex && *TUIndex >= NumLocalTUs) {
16791679
// We have a foreign TU index, which either means we have a .dwo file
1680-
// that has one or more type units, or we have a .dwp file with on or
1680+
// that has one or more type units, or we have a .dwp file with one or
16811681
// more type units. We need to get the type unit from the DWARFContext
16821682
// of the .dwo. We got the NonSkeletonUnitDie above that has the .dwo
16831683
// or .dwp DWARF context, so we have to get the type unit from that file.

0 commit comments

Comments
 (0)