Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,23 @@ class LVForwardReferences {
}

void add(StringRef Name, TypeIndex TIForward) {
if (ForwardTypesNames.find(Name) == ForwardTypesNames.end()) {
ForwardTypesNames.emplace(
std::piecewise_construct, std::forward_as_tuple(Name),
std::forward_as_tuple(TIForward, TypeIndex::None()));
} else {
auto [It, Inserted] =
ForwardTypesNames.try_emplace(Name, TIForward, TypeIndex::None());
if (!Inserted) {
// Update a recorded definition with its reference.
ForwardTypesNames[Name].first = TIForward;
add(TIForward, ForwardTypesNames[Name].second);
It->second.first = TIForward;
add(TIForward, It->second.second);
}
}

// Update a previously recorded forward reference with its definition.
void update(StringRef Name, TypeIndex TIReference) {
auto It = ForwardTypesNames.find(Name);
if (It != ForwardTypesNames.end()) {
auto [It, Inserted] =
ForwardTypesNames.try_emplace(Name, TypeIndex::None(), TIReference);
if (!Inserted) {
// Update the recorded forward reference with its definition.
It->second.second = TIReference;
add(It->second.first, TIReference);
} else {
// We have not seen the forward reference. Insert the definition.
ForwardTypesNames.emplace(
std::piecewise_construct, std::forward_as_tuple(Name),
std::forward_as_tuple(TypeIndex::None(), TIReference));
}
}

Expand Down
Loading