1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

DWARF: avoid unnecessary map lookups.

llvm-svn: 140260
This commit is contained in:
Benjamin Kramer 2011-09-21 17:31:42 +00:00
parent 71bd67ac2e
commit ff31737153

View File

@ -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