summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
-rw-r--r--llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp2
-rw-r--r--llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp6
-rw-r--r--llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp25
3 files changed, 12 insertions, 21 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp
index 0f155a95d60..ccc20eb7488 100644
--- a/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp
@@ -109,7 +109,7 @@ Error DebugChecksumsSubsection::commit(BinaryStreamWriter &Writer) const {
}
uint32_t DebugChecksumsSubsection::mapChecksumOffset(StringRef FileName) const {
- uint32_t Offset = Strings.getIdForString(FileName);
+ uint32_t Offset = Strings.getStringId(FileName);
auto Iter = OffsetMap.find(Offset);
assert(Iter != OffsetMap.end());
return Iter->second;
diff --git a/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp
index 9a3d3e3e247..88c0076915b 100644
--- a/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp
@@ -80,13 +80,13 @@ Error DebugCrossModuleImportsSubsection::commit(
Ids.push_back(&M);
std::sort(Ids.begin(), Ids.end(), [this](const T &L1, const T &L2) {
- return Strings.getIdForString(L1->getKey()) <
- Strings.getIdForString(L2->getKey());
+ return Strings.getStringId(L1->getKey()) <
+ Strings.getStringId(L2->getKey());
});
for (const auto &Item : Ids) {
CrossModuleImport Imp;
- Imp.ModuleNameOffset = Strings.getIdForString(Item->getKey());
+ Imp.ModuleNameOffset = Strings.getStringId(Item->getKey());
Imp.Count = Item->getValue().size();
if (auto EC = Writer.writeObject(Imp))
return EC;
diff --git a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
index c731b68625c..d723282eb71 100644
--- a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
@@ -46,15 +46,12 @@ DebugStringTableSubsection::DebugStringTableSubsection()
: DebugSubsection(DebugSubsectionKind::StringTable) {}
uint32_t DebugStringTableSubsection::insert(StringRef S) {
- auto P = StringToId.insert({S, StringSize});
+ auto P = Strings.insert({S, StringSize});
// If a given string didn't exist in the string table, we want to increment
- // the string table size and insert it into the reverse lookup.
- if (P.second) {
- IdToString.insert({P.first->getValue(), P.first->getKey()});
+ // the string table size.
+ if (P.second)
StringSize += S.size() + 1; // +1 for '\0'
- }
-
return P.first->second;
}
@@ -70,7 +67,7 @@ Error DebugStringTableSubsection::commit(BinaryStreamWriter &Writer) const {
if (auto EC = Writer.writeCString(StringRef()))
return EC;
- for (auto &Pair : StringToId) {
+ for (auto &Pair : Strings) {
StringRef S = Pair.getKey();
uint32_t Offset = Begin + Pair.getValue();
Writer.setOffset(Offset);
@@ -84,16 +81,10 @@ Error DebugStringTableSubsection::commit(BinaryStreamWriter &Writer) const {
return Error::success();
}
-uint32_t DebugStringTableSubsection::size() const { return StringToId.size(); }
-
-uint32_t DebugStringTableSubsection::getIdForString(StringRef S) const {
- auto Iter = StringToId.find(S);
- assert(Iter != StringToId.end());
- return Iter->second;
-}
+uint32_t DebugStringTableSubsection::size() const { return Strings.size(); }
-StringRef DebugStringTableSubsection::getStringForId(uint32_t Id) const {
- auto Iter = IdToString.find(Id);
- assert(Iter != IdToString.end());
+uint32_t DebugStringTableSubsection::getStringId(StringRef S) const {
+ auto Iter = Strings.find(S);
+ assert(Iter != Strings.end());
return Iter->second;
}
OpenPOWER on IntegriCloud