diff options
author | Tom de Vries <tdevries@suse.de> | 2023-08-09 00:58:29 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-08-09 00:58:29 +0200 |
commit | 7570a17cbbe647db6260ae2391f92c0509de7924 (patch) | |
tree | e104924c4586d0b4da4deb2a51cd216dff4ec01f /gdb/cp-support.c | |
parent | e3b66187192ce6840df283c00f6395bb0ff15cf5 (diff) | |
download | gdb-7570a17cbbe647db6260ae2391f92c0509de7924.zip gdb-7570a17cbbe647db6260ae2391f92c0509de7924.tar.gz gdb-7570a17cbbe647db6260ae2391f92c0509de7924.tar.bz2 |
[gdb/build] Use move capture in gdb_demangle
Use move capture in gdb_demangle when compiling for c++14 or higher, to save a
std::string copy.
Tested on x86_64-linux.
Reported-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r-- | gdb/cp-support.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 2fb9d9e..0300727 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1656,7 +1656,13 @@ gdb_demangle (const char *name, int options) we might be in a background thread. Instead, arrange for the reporting to happen on the main thread. */ std::string copy = name; - run_on_main_thread ([=] () + run_on_main_thread ([ +#if __cplusplus >= 201402L + =, copy = std::move (copy) +#else + = +#endif + ] () { report_failed_demangle (copy.c_str (), core_dump_allowed, crash_signal); |