diff options
author | Paul Herman <paulherman@google.com> | 2015-09-17 19:32:02 +0000 |
---|---|---|
committer | Paul Herman <paulherman@google.com> | 2015-09-17 19:32:02 +0000 |
commit | f6681b4ace0375ac011da18e1e406944abf400ab (patch) | |
tree | 40cceaa72dd1c00b8e5f93f299f07c0e4aaecbbd /lldb/source/Plugins/SymbolFile | |
parent | 5493e31be0d12c120992c43785a67fa045969872 (diff) | |
download | bcm5719-llvm-f6681b4ace0375ac011da18e1e406944abf400ab.tar.gz bcm5719-llvm-f6681b4ace0375ac011da18e1e406944abf400ab.zip |
Fix caching for clang::Decl in DWARFASTParserClang
Reviewers: sivachandra, chaoren, clayborg, tberghammer
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12942
llvm-svn: 247923
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 8782ac9526e..8fbe50bd7cc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -3225,13 +3225,31 @@ DWARFASTParserClang::GetClangDeclForDIE (const DWARFDIE &die) if (!die) return nullptr; - if (die.GetReferencedDIE(DW_AT_specification)) - return GetClangDeclForDIE(die.GetReferencedDIE(DW_AT_specification)); + switch (die.Tag()) + { + case DW_TAG_variable: + case DW_TAG_constant: + case DW_TAG_formal_parameter: + case DW_TAG_imported_declaration: + case DW_TAG_imported_module: + break; + default: + return nullptr; + } - clang::Decl *decl = m_die_to_decl[die.GetDIE()]; - if (decl != nullptr) + DIEToDeclMap::iterator cache_pos = m_die_to_decl.find(die.GetDIE()); + if (cache_pos != m_die_to_decl.end()) + return cache_pos->second; + + if (DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification)) + { + clang::Decl *decl = GetClangDeclForDIE(spec_die); + m_die_to_decl[die.GetDIE()] = decl; + m_decl_to_die[decl].insert(die.GetDIE()); return decl; + } + clang::Decl *decl = nullptr; switch (die.Tag()) { case DW_TAG_variable: |