From 2eeb4e5bd45960300c8757cc5c20588ca8817739 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 21 Sep 2011 17:31:42 +0000 Subject: DWARF: avoid unnecessary map lookups. llvm-svn: 140260 --- llvm/lib/DebugInfo/DWARFDebugLine.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'llvm/lib/DebugInfo/DWARFDebugLine.cpp') diff --git a/llvm/lib/DebugInfo/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARFDebugLine.cpp index d8200a0..c91281c 100644 --- a/llvm/lib/DebugInfo/DWARFDebugLine.cpp +++ b/llvm/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 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 -- cgit v1.1