[DWARFLinker] Avoid repeated hash lookups (NFC) (#108737)
This commit is contained in:
parent
56f061f71b
commit
ddca79aaee
@ -371,16 +371,11 @@ public:
|
||||
/// If descriptor does not exist then creates it.
|
||||
SectionDescriptor &
|
||||
getOrCreateSectionDescriptor(DebugSectionKind SectionKind) {
|
||||
SectionsSetTy::iterator It = SectionDescriptors.find(SectionKind);
|
||||
auto [It, Inserted] = SectionDescriptors.try_emplace(SectionKind);
|
||||
|
||||
if (It == SectionDescriptors.end()) {
|
||||
SectionDescriptor *Section =
|
||||
new SectionDescriptor(SectionKind, GlobalData, Format, Endianness);
|
||||
auto Result = SectionDescriptors.try_emplace(SectionKind, Section);
|
||||
assert(Result.second);
|
||||
|
||||
It = Result.first;
|
||||
}
|
||||
if (Inserted)
|
||||
It->second = std::make_shared<SectionDescriptor>(SectionKind, GlobalData,
|
||||
Format, Endianness);
|
||||
|
||||
return *It->second;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user