From 0b72cde372f4ac58d3027e94ac48672a5698d80a Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 10 Aug 2023 17:57:46 +0100 Subject: gdb: add gdb::make_unique function While GDB is still C++11, lets add a gdb::make_unique template function that can be used to create std::unique_ptr objects, just like the C++14 std::make_unique. If GDB is being compiled with a C++14 compiler then the new gdb::make_unique function will delegate to the std::make_unique. I checked with gcc, and at -O1 and above gdb::make_unique will be optimised away completely in this case. If C++14 (or later) becomes our minimum, then it will be easy enough to go through the code and replace gdb::make_unique with std::make_unique later on. I've make use of this function in all the places I think this can easily be used, though I'm sure I've probably missed some. Should be no user visible changes after this commit. Approved-By: Tom Tromey --- gdb/dwarf2/read-debug-names.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/dwarf2/read-debug-names.c') diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index 3d96bf4..2e5067e 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -462,7 +462,7 @@ create_cus_from_debug_names (dwarf2_per_bfd *per_bfd, bool dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile) { - std::unique_ptr map (new mapped_debug_names); + auto map = gdb::make_unique (); mapped_debug_names dwz_map; struct objfile *objfile = per_objfile->objfile; dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; -- cgit v1.1