[Lldb-commits] [PATCH] D12942: Fix caching for clang::Decl in DWARFASTParserClang

Paul Herman via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 17 10:39:52 PDT 2015


paulherman created this revision.
paulherman added reviewers: sivachandra, chaoren, tberghammer, clayborg.
paulherman added a subscriber: lldb-commits.

http://reviews.llvm.org/D12942

Files:
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3225,13 +3225,19 @@
     if (!die)
         return nullptr;
 
-    if (die.GetReferencedDIE(DW_AT_specification))
-        return GetClangDeclForDIE(die.GetReferencedDIE(DW_AT_specification));
+    DIEToDeclMap::iterator cache_pos = m_die_to_decl.find(die.GetDIE());
+    if (cache_pos != m_die_to_decl.end())
+        return cache_pos->second;
 
-    clang::Decl *decl = m_die_to_decl[die.GetDIE()];
-    if (decl != nullptr)
+    if (die.GetReferencedDIE(DW_AT_specification))
+    {
+        clang::Decl *decl = GetClangDeclForDIE(die.GetReferencedDIE(DW_AT_specification));
+        m_die_to_decl[die.GetDIE()] = decl;
+        m_decl_to_die[decl].insert(die.GetDIE());
         return decl;
+    }
 
+    clang::Decl *decl = m_die_to_decl[die.GetDIE()];
     switch (die.Tag())
     {
         case DW_TAG_variable:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12942.35016.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150917/49b9abe5/attachment.bin>


More information about the lldb-commits mailing list