diff options
author | Tom Tromey <tromey@adacore.com> | 2021-10-04 08:44:22 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-10-04 13:45:38 -0600 |
commit | 3456e70c9d69da8d62a0ea1f8c2e643648afc654 (patch) | |
tree | 7959a8dc460685d2e8e3197478eddb4430d48708 /gdb/dwarf2 | |
parent | e133de4984cef9acb32fd756c607aa2fa1d090fb (diff) | |
download | binutils-gdb-3456e70c9d69da8d62a0ea1f8c2e643648afc654.tar.gz |
Use unique_xmalloc_ptr<char> when demangling
I noticed that some methods in language_defn could use
unique_xmalloc_ptr<char> rather than a plain 'char *'. This patch
implements this change, fixing up the fallout and changing
gdb_demangle to also return this type. In one spot, std::string is
used to simplify some related code, and in another, an auto_obstack is
used to avoid manual management.
Regression tested on x86-64 Fedora 34.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/read.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e036b2eac63..5d48e4c133a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10174,9 +10174,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) to look up their definition from their declaration so the only disadvantage remains the minimal symbol variant `long name(params)' does not have the proper inferior type. */ - demangled.reset (gdb_demangle (mangled, - (DMGL_PARAMS | DMGL_ANSI - | DMGL_RET_DROP))); + demangled = gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI + | DMGL_RET_DROP)); } if (demangled) canon = demangled.get (); |