[llvm] 8b6764f - [DebugInfo] Simplify code with std::unordered_map::operator[] (NFC) (#112658)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 07:47:10 PDT 2024


Author: Kazu Hirata
Date: 2024-10-17T07:47:06-07:00
New Revision: 8b6764fdc0c9550e3d8033006a4acfb466f74840

URL: https://github.com/llvm/llvm-project/commit/8b6764fdc0c9550e3d8033006a4acfb466f74840
DIFF: https://github.com/llvm/llvm-project/commit/8b6764fdc0c9550e3d8033006a4acfb466f74840.diff

LOG: [DebugInfo] Simplify code with std::unordered_map::operator[] (NFC) (#112658)

Added: 
    

Modified: 
    llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
index e85356b5eab0f4..1c523c01314977 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
@@ -1139,9 +1139,8 @@ void LVDWARFReader::updateReference(dwarf::Attribute Attr,
 // Get an element given the DIE offset.
 LVElement *LVDWARFReader::getElementForOffset(LVOffset Offset,
                                               LVElement *Element, bool IsType) {
-  auto Iter = ElementTable.try_emplace(Offset).first;
   // Update the element and all the references pointing to this element.
-  LVElementEntry &Entry = Iter->second;
+  LVElementEntry &Entry = ElementTable[Offset];
   if (!Entry.Element) {
     if (IsType)
       Entry.Types.insert(Element);


        


More information about the llvm-commits mailing list