diff options
author | Tom Tromey <tom@tromey.com> | 2024-02-03 14:32:06 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-02-04 15:37:55 -0700 |
commit | b36a26343a6c62b313d9e101b369155b6b799535 (patch) | |
tree | c5a73b5832f4ccbb914626230e2aeac11db0ab59 /gdb/buildsym.c | |
parent | 029e52bac7f3a6dd8b39f7f3d298b73174da806b (diff) | |
download | gdb-b36a26343a6c62b313d9e101b369155b6b799535.zip gdb-b36a26343a6c62b313d9e101b369155b6b799535.tar.gz gdb-b36a26343a6c62b313d9e101b369155b6b799535.tar.bz2 |
Use reference result of emplace_back
Starting with C++17, emplace_back returns a reference to the new
object. This patch changes code that uses emplace_back followed by a
call to back() to simply use this reference instead.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r-- | gdb/buildsym.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c index a963219..5061109 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -661,8 +661,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line, return; } - subfile->line_vector_entries.emplace_back (); - linetable_entry &e = subfile->line_vector_entries.back (); + linetable_entry &e = subfile->line_vector_entries.emplace_back (); e.line = line; e.is_stmt = (flags & LEF_IS_STMT) != 0; e.set_unrelocated_pc (pc); @@ -1134,8 +1133,7 @@ buildsym_compunit::augment_type_symtab () struct context_stack * buildsym_compunit::push_context (int desc, CORE_ADDR valu) { - m_context_stack.emplace_back (); - struct context_stack *newobj = &m_context_stack.back (); + struct context_stack *newobj = &m_context_stack.emplace_back (); newobj->depth = desc; newobj->locals = m_local_symbols; |