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
26 changes: 11 additions & 15 deletions llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ using namespace llvm::logicalview;
void LVSymbolTable::add(StringRef Name, LVScope *Function,
LVSectionIndex SectionIndex) {
std::string SymbolName(Name);
if (SymbolNames.find(SymbolName) == SymbolNames.end()) {
SymbolNames.emplace(
std::piecewise_construct, std::forward_as_tuple(SymbolName),
std::forward_as_tuple(Function, 0, SectionIndex, false));
} else {
auto [It, Inserted] =
SymbolNames.try_emplace(SymbolName, Function, 0, SectionIndex, false);
if (!Inserted) {
// Update a recorded entry with its logical scope and section index.
SymbolNames[SymbolName].Scope = Function;
It->second.Scope = Function;
if (SectionIndex)
SymbolNames[SymbolName].SectionIndex = SectionIndex;
It->second.SectionIndex = SectionIndex;
}

if (Function && SymbolNames[SymbolName].IsComdat)
if (Function && It->second.IsComdat)
Function->setIsComdat();

LLVM_DEBUG({ print(dbgs()); });
Expand All @@ -44,15 +42,13 @@ void LVSymbolTable::add(StringRef Name, LVScope *Function,
void LVSymbolTable::add(StringRef Name, LVAddress Address,
LVSectionIndex SectionIndex, bool IsComdat) {
std::string SymbolName(Name);
if (SymbolNames.find(SymbolName) == SymbolNames.end())
SymbolNames.emplace(
std::piecewise_construct, std::forward_as_tuple(SymbolName),
std::forward_as_tuple(nullptr, Address, SectionIndex, IsComdat));
else
auto [It, Inserted] = SymbolNames.try_emplace(SymbolName, nullptr, Address,
SectionIndex, IsComdat);
if (!Inserted)
// Update a recorded symbol name with its logical scope.
SymbolNames[SymbolName].Address = Address;
It->second.Address = Address;

LVScope *Function = SymbolNames[SymbolName].Scope;
LVScope *Function = It->second.Scope;
if (Function && IsComdat)
Function->setIsComdat();
LLVM_DEBUG({ print(dbgs()); });
Expand Down
Loading