diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-21 17:31:42 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-21 17:31:42 +0000 |
commit | 1d13d9ed969259d3be267cf0e2c6fe92c1baed49 (patch) | |
tree | 9f8222a1fa3039bd6f1df57784bece6031e5f1bf /lib/DebugInfo/DWARFDebugLine.cpp | |
parent | 64ac73bb15e510c268479646816ec069ff12cd64 (diff) |
DWARF: avoid unnecessary map lookups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFDebugLine.cpp')
-rw-r--r-- | lib/DebugInfo/DWARFDebugLine.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/DebugInfo/DWARFDebugLine.cpp b/lib/DebugInfo/DWARFDebugLine.cpp index d8200a0fd6..c91281cac8 100644 --- a/lib/DebugInfo/DWARFDebugLine.cpp +++ b/lib/DebugInfo/DWARFDebugLine.cpp @@ -116,17 +116,16 @@ DWARFDebugLine::getLineTable(uint32_t offset) const { const DWARFDebugLine::LineTable * DWARFDebugLine::getOrParseLineTable(DataExtractor debug_line_data, uint32_t offset) { - LineTableIter pos = LineTableMap.find(offset); - if (pos == LineTableMap.end()) { + std::pair<LineTableIter, bool> pos = + LineTableMap.insert(LineTableMapTy::value_type(offset, LineTable())); + if (pos.second) { // Parse and cache the line table for at this offset. State state; if (!parseStatementTable(debug_line_data, &offset, state)) return 0; - // FIXME: double lookup. - LineTableMap[offset] = state; - return &LineTableMap[offset]; + pos.first->second = state; } - return &pos->second; + return &pos.first->second; } bool |