{
if (!subfile->line_vector_entries.empty ())
{
- const auto lte_is_less_than
- = [] (const linetable_entry &ln1,
- const linetable_entry &ln2) -> bool
- {
- if (ln1.pc == ln2.pc
- && ((ln1.line == 0) != (ln2.line == 0)))
- return ln1.line == 0;
-
- return (ln1.pc < ln2.pc);
- };
-
/* Like the pending blocks, the line table may be scrambled
in reordered executables. Sort it. It is important to
preserve the order of lines at the same address, as this
maintains the inline function caller/callee
relationships, this is why std::stable_sort is used. */
std::stable_sort (subfile->line_vector_entries.begin (),
- subfile->line_vector_entries.end (),
- lte_is_less_than);
+ subfile->line_vector_entries.end ());
}
/* Allocate a symbol table if necessary. */
for (; i < nlines - 1 && le[i].pc < high; i++)
{
- if (le[i].line == le[i + 1].line && le[i].pc == le[i + 1].pc)
+ if (le[i] == le[i + 1])
continue; /* Ignore duplicates. */
/* Skip any end-of-function markers. */
struct linetable_entry
{
+ bool operator< (const linetable_entry &other) const
+ {
+ if (pc == other.pc
+ && (line != 0) != (other.line != 0))
+ return line == 0;
+ return pc < other.pc;
+ }
+
+ /* Two entries are equal if they have the same line and PC. The
+ other members are ignored. */
+ bool operator== (const linetable_entry &other) const
+ { return line == other.line && pc == other.pc; }
+
/* The line number for this entry. */
int line;
if (fentries.empty ())
return;
- std::sort (fentries.begin (), fentries.end (),
- [] (const linetable_entry <e1, const linetable_entry& lte2)
- { return lte1.pc < lte2.pc; });
+ std::sort (fentries.begin (), fentries.end ());
/* Allocate a new line table. */
std::vector<linetable_entry> new_linetable;