Skip to content

Commit 72ff5d8

Browse files
committed
cleanup
1 parent 4d30a5c commit 72ff5d8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ void DWARFGdbIndex::dumpSymbolTable(raw_ostream &OS) const {
6262
SymbolTableOffset, (uint64_t)SymbolTable.size())
6363
<< '\n';
6464

65-
llvm::DenseMap<uint32_t, decltype(ConstantPoolVectors)::const_pointer>
66-
CuVectorMap(ConstantPoolVectors.size());
67-
for (const auto& [Offset, CUVector] : ConstantPoolVectors)
68-
CuVectorMap.try_emplace(Offset, &CUVector);
65+
llvm::DenseMap<uint32_t, uint32_t> OffsetToIdMap(ConstantPoolVectors.size());
66+
for (uint32_t Id = 0; Id < ConstantPoolVectors.size(); ++Id)
67+
OffsetToIdMap[ConstantPoolVectors[Id].first] = Id;
6968

70-
const auto FindCuVector =[&](uint32_t VecOffset) {
71-
const auto It = CuVectorMap.find(VecOffset);
72-
return It != CuVectorMap.end() ? It->second : ConstantPoolVectors.end();
73-
};
69+
const auto FindCuVectorId = [&](uint32_t VecOffset) {
70+
const auto It = OffsetToIdMap.find(VecOffset);
71+
assert(It != OffsetToIdMap.end() && "Invalid symbol table");
72+
return It->second;
73+
};
7474

7575
uint32_t I = -1;
7676
for (const SymTableEntry &E : SymbolTable) {
@@ -84,9 +84,7 @@ void DWARFGdbIndex::dumpSymbolTable(raw_ostream &OS) const {
8484
StringRef Name = ConstantPoolStrings.substr(
8585
ConstantPoolOffset - StringPoolOffset + E.NameOffset);
8686

87-
const auto* CuVector = FindCuVector(E.VecOffset);
88-
assert(CuVector != ConstantPoolVectors.end() && "Invalid symbol table");
89-
uint32_t CuVectorId = CuVector - ConstantPoolVectors.begin();
87+
const uint32_t CuVectorId = FindCuVectorId(E.VecOffset);
9088
OS << format(" String name: %s, CU vector index: %d\n", Name.data(),
9189
CuVectorId);
9290
}

0 commit comments

Comments
 (0)