This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] compile: Remove non-const reference parameters
- From: Tom Tromey <tom at tromey dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>, Keith Seitz <keiths at redhat dot com>
- Date: Mon, 17 Sep 2018 00:31:19 -0600
- Subject: Re: [PATCH] compile: Remove non-const reference parameters
- References: <1535647635-9566-1-git-send-email-simon.marchi@ericsson.com>
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
Simon> As mentioned here:
Simon> https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead
Simon> we prefer to avoid non-const references. This patch changes the
Simon> non-const references I could find in the compile/ directory, either by
Simon> making them const or changing them to pointers.
Simon> I'd say all the changes are pretty obvious, except the one in
Simon> compile_cplus_instance::enter_scope which might require more attention.
I think this particular change introduced a regression. runtest
gdb.compile/*.exp causes gdb to crash for me several times on x86-64
Fedora 28.
The code does this:
/* Save the new scope. */
m_scopes.push_back (std::move (new_scope));
... but then later code in the function continues to use new_scope,
like:
std::for_each
(new_scope.begin (), new_scope.end () - 1,
Tom