summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARFDebugLine.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-09-21 17:31:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-09-21 17:31:42 +0000
commit2eeb4e5bd45960300c8757cc5c20588ca8817739 (patch)
tree6122e3128d272f2b7329a556b1d39ca8ab8a3f4d /llvm/lib/DebugInfo/DWARFDebugLine.cpp
parent50f123d8e5c64af5d192c91dc342ff48dd48d714 (diff)
downloadbcm5719-llvm-2eeb4e5bd45960300c8757cc5c20588ca8817739.tar.gz
bcm5719-llvm-2eeb4e5bd45960300c8757cc5c20588ca8817739.zip
DWARF: avoid unnecessary map lookups.
llvm-svn: 140260
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFDebugLine.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARFDebugLine.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARFDebugLine.cpp
index d8200a0fd6b..c91281cac8a 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<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
OpenPOWER on IntegriCloud