]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/registry: make registry::key::emplace return a reference
authorSimon Marchi <simon.marchi@polymtl.ca>
Sun, 8 Feb 2026 22:04:10 +0000 (17:04 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Feb 2026 17:48:35 +0000 (12:48 -0500)
Since we use C++ and not C, I think that we should gradually move to
using references for things that can never be nullptr.  One example of
this is the return value of the emplace method.

Change it to return a reference, and (to keep the patch straightforward)
update all callers to take the address.  More patches could follow to
propagate the use of references further.

Change-Id: I725539694cf496f8288918cc29d7aaae9aca2292
Approved-By: Tom Tromey <tom@tromey.com>
47 files changed:
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/aix-thread.c
gdb/amd-dbgapi-target.c
gdb/arm-tdep.c
gdb/auto-load.c
gdb/auxv.c
gdb/break-catch-syscall.c
gdb/breakpoint.c
gdb/bsd-uthread.c
gdb/dwarf2/expr.c
gdb/dwarf2/frame.c
gdb/dwarf2/read.c
gdb/elfread.c
gdb/fbsd-tdep.c
gdb/frame-base.c
gdb/frame-unwind.c
gdb/gdb_bfd.c
gdb/gdbtypes.c
gdb/guile/scm-arch.c
gdb/guile/scm-symbol.c
gdb/hppa-tdep.c
gdb/ia64-libunwind-tdep.c
gdb/inflow.c
gdb/jit.c
gdb/linux-fork.c
gdb/linux-tdep.c
gdb/netbsd-tdep.c
gdb/objc-lang.c
gdb/objfiles.c
gdb/python/py-registers.c
gdb/python/py-unwind.c
gdb/reggroups.c
gdb/registry.h
gdb/remote-sim.c
gdb/remote.c
gdb/rs6000-tdep.c
gdb/solib-aix.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-rocm.c
gdb/solib-svr4.c
gdb/source.c
gdb/svr4-tls-tdep.c
gdb/symtab.c
gdb/target-descriptions.c
gdb/windows-tdep.c

index 4c89776777f2fdcb15241205db09387a019e7c7d..eaac2816880e133d1369001529cc2f245e5bbbf6 100644 (file)
@@ -311,7 +311,7 @@ get_ada_inferior_data (struct inferior *inf)
 
   data = ada_inferior_data.get (inf);
   if (data == NULL)
-    data = ada_inferior_data.emplace (inf);
+    data = &ada_inferior_data.emplace (inf);
 
   return data;
 }
@@ -399,7 +399,7 @@ get_ada_pspace_data (struct program_space *pspace)
 {
   cache_entry_set *data = ada_pspace_data_handle.get (pspace);
   if (data == nullptr)
-    data = ada_pspace_data_handle.emplace (pspace);
+    data = &ada_pspace_data_handle.emplace (pspace);
 
   return *data;
 }
index 798d9c4cb325a07b25ed54081f903d89a144656b..22ba47c262d0ebe9bd86b17ae47a79a883825ae4 100644 (file)
@@ -300,7 +300,7 @@ get_ada_tasks_pspace_data (struct program_space *pspace)
 
   data = ada_tasks_pspace_data_handle.get (pspace);
   if (data == NULL)
-    data = ada_tasks_pspace_data_handle.emplace (pspace);
+    data = &ada_tasks_pspace_data_handle.emplace (pspace);
 
   return data;
 }
@@ -324,7 +324,7 @@ get_ada_tasks_inferior_data (struct inferior *inf)
 
   data = ada_tasks_inferior_data_handle.get (inf);
   if (data == NULL)
-    data = ada_tasks_inferior_data_handle.emplace (inf);
+    data = &ada_tasks_inferior_data_handle.emplace (inf);
 
   return data;
 }
index 196942f064c80250060a32d51b8d3afcd91cb35a..120b032fcf4e488ead45eb16bcf1d55aed0f0d4a 100644 (file)
@@ -209,7 +209,7 @@ get_aix_thread_variables_data (struct inferior *inf)
 
   data = aix_thread_variables_handle.get (inf);
   if (data == NULL)
-    data = aix_thread_variables_handle.emplace (inf);
+    data = &aix_thread_variables_handle.emplace (inf);
 
   return data;
 }
index 4e52683dc55afccb1d040706590fc18cb257a8d9..d636f1a39ed6fcbcb725588640b0016d94039833 100644 (file)
@@ -372,7 +372,7 @@ get_amd_dbgapi_inferior_info (inferior *inferior)
   amd_dbgapi_inferior_info *info = amd_dbgapi_inferior_data.get (inferior);
 
   if (info == nullptr)
-    info = amd_dbgapi_inferior_data.emplace (inferior, inferior);
+    info = &amd_dbgapi_inferior_data.emplace (inferior, inferior);
 
   return *info;
 }
index e4c8b78de030e1395d93ad474ecf8b5b65be808e..7d6aa06f2337e9df68c5b7cd2be7262f8595a015 100644 (file)
@@ -2571,7 +2571,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
     }
 
   /* Allocate exception table data structure.  */
-  data = arm_exidx_data_key.emplace (objfile->obfd.get ());
+  data = &arm_exidx_data_key.emplace (objfile->obfd.get ());
   data->section_maps.resize (objfile->obfd->section_count);
 
   /* Fill in exception table.  */
@@ -9745,8 +9745,8 @@ arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
 
   data = arm_bfd_data_key.get (objfile->obfd.get ());
   if (data == NULL)
-    data = arm_bfd_data_key.emplace (objfile->obfd.get (),
-                                    objfile->obfd->section_count);
+    data = &arm_bfd_data_key.emplace (objfile->obfd.get (),
+                                     objfile->obfd->section_count);
   arm_mapping_symbol_vec &map
     = data->section_maps[bfd_asymbol_section (sym)->index];
 
index ca9799c368248c8d7069c88a1412542511f2d7ed..b7e62626ab7da2a17bdcf72cb69ea4e5d4a34b85 100644 (file)
@@ -612,7 +612,7 @@ get_auto_load_pspace_data (struct program_space *pspace)
 
   info = auto_load_pspace_data.get (pspace);
   if (info == NULL)
-    info = auto_load_pspace_data.emplace (pspace);
+    info = &auto_load_pspace_data.emplace (pspace);
 
   return info;
 }
index 59f38d3cf49fff9ad65e3d05356cda7de8f2ce60..1a58fd8c844e9c03270964998b12886c9c1f1c1e 100644 (file)
@@ -365,7 +365,7 @@ target_read_auxv ()
 
   if (info == nullptr)
     {
-      info = auxv_inferior_data.emplace (inf);
+      info = &auxv_inferior_data.emplace (inf);
       info->data = target_read_auxv_raw (inf->top_target ());
     }
 
index 0cf594e6fdc6a4c137ca16c0a8101953fe125113..43f12862052286d3e8fe9b5322c9f8bba6f5b760 100644 (file)
@@ -86,7 +86,7 @@ get_catch_syscall_inferior_data (struct inferior *inf)
 
   inf_data = catch_syscall_inferior_data.get (inf);
   if (inf_data == NULL)
-    inf_data = catch_syscall_inferior_data.emplace (inf);
+    inf_data = &catch_syscall_inferior_data.emplace (inf);
 
   return inf_data;
 }
index f8fa7bcb142069593969288f4fd335491d4bcbd5..82514384d98e87c32ab426180d933eb890b7d870 100644 (file)
@@ -3657,7 +3657,7 @@ get_breakpoint_objfile_data (struct objfile *objfile)
 
   bp_objfile_data = breakpoint_objfile_key.get (objfile);
   if (bp_objfile_data == NULL)
-    bp_objfile_data = breakpoint_objfile_key.emplace (objfile);
+    bp_objfile_data = &breakpoint_objfile_key.emplace (objfile);
   return bp_objfile_data;
 }
 
index 2da1197ef8b0fcceaee7b3f78afd6ba791a27897..9d91893c6cf36d59a766c080c3fa10a857c9387e 100644 (file)
@@ -86,7 +86,7 @@ get_bsd_uthread (struct gdbarch *gdbarch)
 {
   struct bsd_uthread_ops *ops = bsd_uthread_data.get (gdbarch);
   if (ops == nullptr)
-    ops = bsd_uthread_data.emplace (gdbarch);
+    ops = &bsd_uthread_data.emplace (gdbarch);
   return ops;
 }
 
index b0eac5c6bf4465da3dc1f78a5dae481e9f5d87ff..a5026e133c91364f339b6f4cc7e3839097619319 100644 (file)
@@ -711,7 +711,7 @@ dwarf_expr_context::address_type () const
   gdbarch *arch = this->m_per_objfile->objfile->arch ();
   dwarf_gdbarch_types *types = dwarf_arch_cookie.get (arch);
   if (types == nullptr)
-    types = dwarf_arch_cookie.emplace (arch);
+    types = &dwarf_arch_cookie.emplace (arch);
   int ndx;
 
   if (this->m_addr_size == 2)
index b6d5aac8a76a0d2acac92a1483dbb7555a775d7c..a4dada8a78993d44ac5f45109e5187dd24272924 100644 (file)
@@ -610,7 +610,7 @@ get_frame_ops (struct gdbarch *gdbarch)
 {
   dwarf2_frame_ops *result = dwarf2_frame_data.get (gdbarch);
   if (result == nullptr)
-    result = dwarf2_frame_data.emplace (gdbarch);
+    result = &dwarf2_frame_data.emplace (gdbarch);
   return result;
 }
 
index 7a977a97a465a2c3ae6aee163c1b79dbe8c347ed..6061df0ecb8efc48a27a6cf88719e9034b36a3fb 100644 (file)
@@ -1213,7 +1213,8 @@ dwarf2_has_info (struct objfile *objfile,
          just_created = true;
        }
 
-      per_objfile = dwarf2_objfile_data_key.emplace (objfile, objfile, per_bfd);
+      per_objfile
+       = &dwarf2_objfile_data_key.emplace (objfile, objfile, per_bfd);
     }
 
   /* Virtual sections are created from DWP files.  It's not clear those
index 60785ace56d1d54c47b53a5f190d04adff94d4b3..722f21bf77536ad26e8c05da32977fb1197195ff 100644 (file)
@@ -1295,7 +1295,7 @@ elf_get_probes (struct objfile *objfile)
 
   if (probes_per_bfd == NULL)
     {
-      probes_per_bfd = probe_key.emplace (objfile->obfd.get ());
+      probes_per_bfd = &probe_key.emplace (objfile->obfd.get ());
 
       /* Here we try to gather information about all types of probes from the
         objfile.  */
index ae11e2e85ee93a8039b38c3baa3acb4408f54aed..2ddba1660ded39145022808a45512701e9d9e968 100644 (file)
@@ -498,7 +498,7 @@ get_fbsd_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct fbsd_gdbarch_data *result = fbsd_gdbarch_data_handle.get (gdbarch);
   if (result == nullptr)
-    result = fbsd_gdbarch_data_handle.emplace (gdbarch);
+    result = &fbsd_gdbarch_data_handle.emplace (gdbarch);
   return result;
 }
 
@@ -528,7 +528,7 @@ get_fbsd_pspace_data (struct program_space *pspace)
 
   data = fbsd_pspace_data_handle.get (pspace);
   if (data == NULL)
-    data = fbsd_pspace_data_handle.emplace (pspace);
+    data = &fbsd_pspace_data_handle.emplace (pspace);
 
   return data;
 }
index 905c15e5047d1955739148d48bd8ce90d6d86e05..a732e1efc9a5b6d7c3ec69ea9562dfba6a4dfe10 100644 (file)
@@ -72,7 +72,7 @@ get_frame_base_table (struct gdbarch *gdbarch)
 {
   struct frame_base_table *table = frame_base_data.get (gdbarch);
   if (table == nullptr)
-    table = frame_base_data.emplace (gdbarch);
+    table = &frame_base_data.emplace (gdbarch);
   return table;
 }
 
index 16d1fb1d62e403bde0462aafad8b42171c2504f9..49ade0043a10f00bb3ab9b94103ca52899fdfc63 100644 (file)
@@ -76,9 +76,9 @@ get_frame_unwind_table (struct gdbarch *gdbarch)
 {
   std::vector<const frame_unwind *> *table = frame_unwind_data.get (gdbarch);
   if (table == nullptr)
-    table = frame_unwind_data.emplace (gdbarch,
-                                      standard_unwinders.begin (),
-                                      standard_unwinders.end ());
+    table = &frame_unwind_data.emplace (gdbarch,
+                                       standard_unwinders.begin (),
+                                       standard_unwinders.end ());
   return *table;
 }
 
index 7f4c302b759a51caaa006a5efeb2ca462f683abd..cbf8e7054794002390b782b45f3cfd45acd76195 100644 (file)
@@ -1258,7 +1258,7 @@ get_bfd_inferior_data (struct inferior *inf)
 
   data = bfd_inferior_data_key.get (inf);
   if (data == nullptr)
-    data = bfd_inferior_data_key.emplace (inf);
+    data = &bfd_inferior_data_key.emplace (inf);
 
   return data;
 }
index f0729bece596389718a0bb225917892fc1d7826e..2b6244d6f38bc699b4337997fea9e22afca357c3 100644 (file)
@@ -5574,7 +5574,7 @@ allocate_fixed_point_type_info (struct type *type)
       fixed_point_type_storage *storage
        = fixed_point_objfile_key.get (type->objfile_owner ());
       if (storage == nullptr)
-       storage = fixed_point_objfile_key.emplace (type->objfile_owner ());
+       storage = &fixed_point_objfile_key.emplace (type->objfile_owner ());
       info = up.get ();
       storage->push_back (std::move (up));
     }
index db99be81de4d20e5ef4751a0bc1c492c1fbe6698..1bd010c023eb0c2189aca1d9866f6d5916d4eb46 100644 (file)
@@ -124,7 +124,7 @@ arscm_scm_from_arch (struct gdbarch *gdbarch)
         is no call to scm_gc_unprotect_object for it.  */
       scm_gc_protect_object (arch_scm);
 
-      data = arch_object_data.emplace (gdbarch);
+      data = &arch_object_data.emplace (gdbarch);
       data->arch_scm = arch_scm;
     }
 
index f128a45dafd2b19de16ae3b2fac005adc7acc899..e70afa820f2c8f9062ccb925f8579f620c6d4ba2 100644 (file)
@@ -136,7 +136,7 @@ syscm_get_symbol_map (struct symbol *symbol)
       struct syscm_gdbarch_data *data = syscm_gdbarch_data_key.get (gdbarch);
       if (data == nullptr)
        {
-         data = syscm_gdbarch_data_key.emplace (gdbarch);
+         data = &syscm_gdbarch_data_key.emplace (gdbarch);
          data->htab
            = gdbscm_create_eqable_gsmob_ptr_map (syscm_hash_symbol_smob,
                                                  syscm_eq_symbol_smob);
index ae5f5328484ed5cb3b61bdd2fa14a5e6c57b407f..7cd6f2c11b693429671c46371293fdfda33d9f08 100644 (file)
@@ -463,7 +463,7 @@ read_unwind_info (struct objfile *objfile)
   /* Keep a pointer to the unwind information.  */
   obj_private = hppa_objfile_priv_data.get (objfile);
   if (obj_private == NULL)
-    obj_private = hppa_objfile_priv_data.emplace (objfile);
+    obj_private = &hppa_objfile_priv_data.emplace (objfile);
 
   obj_private->unwind_info = ui;
 }
index 06a9752e443a1d2a91b717e073bb4841845d51d9..41c07160cb9c7ab3be56cb89ecd30310a82757eb 100644 (file)
@@ -128,7 +128,7 @@ libunwind_descr (struct gdbarch *gdbarch)
 {
   struct libunwind_descr *result = libunwind_descr_handle.get (gdbarch);
   if (result == nullptr)
-    result = libunwind_descr_handle.emplace (gdbarch);
+    result = &libunwind_descr_handle.emplace (gdbarch);
   return result;
 }
 
index 4c6c70dfee9cb0dfb57303b8bc3e8df2e9fee629..d8271f9caa8482ebe61aa469126e5479088d271e 100644 (file)
@@ -643,7 +643,7 @@ get_inflow_inferior_data (struct inferior *inf)
 
   info = inflow_inferior_data.get (inf);
   if (info == NULL)
-    info = inflow_inferior_data.emplace (inf);
+    info = &inflow_inferior_data.emplace (inf);
 
   return info;
 }
index 4add2fa486120ca1c5386968c43a13f000aee087..db9d18f15071c6cf316619ea528698901e435911 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1153,7 +1153,7 @@ jit_prepend_unwinder (struct gdbarch *gdbarch)
 {
   struct jit_gdbarch_data_type *data = jit_gdbarch_data.get (gdbarch);
   if (data == nullptr)
-    data = jit_gdbarch_data.emplace (gdbarch);
+    data = &jit_gdbarch_data.emplace (gdbarch);
 
   if (!data->unwinder_registered)
     {
index b6429ebb3a1ab75b255c9fa72cf260573db10d5e..59d3eea60690c1ec6fd56ee9d197606ea2b1a37d 100644 (file)
@@ -117,7 +117,7 @@ get_checkpoint_inferior_data (struct inferior *inf)
 
   data = checkpoint_inferior_data_key.get (inf);
   if (data == nullptr)
-    data = checkpoint_inferior_data_key.emplace (inf);
+    data = &checkpoint_inferior_data_key.emplace (inf);
 
   return data;
 }
index ccc7fa7cf9df357ba6161fce0bd07249cd53ad87..9ce28d53283659d9cf303ac2dcbe2aa488c33de8 100644 (file)
@@ -212,7 +212,7 @@ get_linux_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct linux_gdbarch_data *result = linux_gdbarch_data_handle.get (gdbarch);
   if (result == nullptr)
-    result = linux_gdbarch_data_handle.emplace (gdbarch);
+    result = &linux_gdbarch_data_handle.emplace (gdbarch);
   return result;
 }
 
@@ -266,7 +266,7 @@ get_linux_inferior_data (inferior *inf)
   linux_info *info = linux_inferior_data.get (inf);
 
   if (info == nullptr)
-    info = linux_inferior_data.emplace (inf);
+    info = &linux_inferior_data.emplace (inf);
 
   return info;
 }
index 8ad15de087501d78fd765528e5fba1f2a9a36b9c..1d97a7a8b9ad7cef2d3cda6c1aff953b8723baec 100644 (file)
@@ -369,7 +369,7 @@ get_nbsd_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct nbsd_gdbarch_data *result = nbsd_gdbarch_data_handle.get (gdbarch);
   if (result == nullptr)
-    result = nbsd_gdbarch_data_handle.emplace (gdbarch);
+    result = &nbsd_gdbarch_data_handle.emplace (gdbarch);
   return result;
 }
 
index 9d543005370c030d8e1d6f5a4b86084c81243e0a..f14d7f16d376b13f4f0982806542508a767e26fb 100644 (file)
@@ -1085,7 +1085,7 @@ find_methods (char type, const char *theclass, const char *category,
        }
 
       if (objc_csym == NULL)
-       objc_csym = objc_objfile_data.emplace (&objfile, objfile_csym);
+       objc_csym = &objc_objfile_data.emplace (&objfile, objfile_csym);
       else
        /* Count of ObjC methods in this objfile should be constant.  */
        gdb_assert (*objc_csym == objfile_csym);
index db96a1761f8d3a1920d321075db9a9db28030e34..e33368ba19dc4e53667cccd008ddde1d32e96232 100644 (file)
@@ -92,7 +92,7 @@ get_objfile_pspace_data (struct program_space *pspace)
 
   info = objfiles_pspace_data.get (pspace);
   if (info == NULL)
-    info = objfiles_pspace_data.emplace (pspace);
+    info = &objfiles_pspace_data.emplace (pspace);
 
   return info;
 }
index 0ec708364ddc89c48cf7793292798aa8ba4e4fe7..b345229ea619c58d33e98c2e6357b0247b25dd21 100644 (file)
@@ -143,7 +143,7 @@ gdbpy_get_register_descriptor (struct gdbarch *gdbarch,
 {
   gdbpy_register_type *vecp = gdbpy_register_object_data.get (gdbarch);
   if (vecp == nullptr)
-    vecp = gdbpy_register_object_data.emplace (gdbarch);
+    vecp = &gdbpy_register_object_data.emplace (gdbarch);
   gdbpy_register_type &vec = *vecp;
 
   /* Ensure that we have enough entries in the vector.  */
index 7c0779a82708d153f40353aa8f12b92ff6d25888..c2579f3c35a60fc9d01feeb2d169ba8df2254a6b 100644 (file)
@@ -996,7 +996,7 @@ pyuw_on_new_gdbarch (gdbarch *newarch)
 {
   struct pyuw_gdbarch_data_type *data = pyuw_gdbarch_data.get (newarch);
   if (data == nullptr)
-    datapyuw_gdbarch_data.emplace (newarch);
+    data = &pyuw_gdbarch_data.emplace (newarch);
 
   if (!data->unwinder_registered)
     {
index ad22e4c17d40a6069601ff87433ca616d524563a..2bc8e52cb2eaffe0f07e41229423c034cdf27319 100644 (file)
@@ -113,7 +113,7 @@ get_reggroups (struct gdbarch *gdbarch)
 {
   struct reggroups *groups = reggroups_data.get (gdbarch);
   if (groups == nullptr)
-    groups = reggroups_data.emplace (gdbarch);
+    groups = &reggroups_data.emplace (gdbarch);
   return groups;
 }
 
index c1aaadce5125ac51d0b219de24935a05cecc7f8e..3738d4226bb8e3164f00f574ca19a346d7510069 100644 (file)
@@ -124,7 +124,7 @@ public:
        available.  It emplaces a new instance of the associated data
        type and attaches it to OBJ using this key.  The arguments, if
        any, are forwarded to the constructor.  */
-    template<typename Dummy = DATA *, typename... Args>
+    template<typename Dummy = DATA &, typename... Args>
     typename std::enable_if<std::is_same<Deleter,
                                         std::default_delete<DATA>>::value,
                            Dummy>::type
@@ -132,7 +132,7 @@ public:
     {
       DATA *result = new DATA (std::forward<Args> (args)...);
       set (obj, result);
-      return result;
+      return *result;
     }
 
     /* Clear the data attached to OBJ that is associated with this KEY.
index ee2a1b37370130d236814144cb47b6c6a715adf2..95ee9841fe0747386709a9199b826f85b1a50214 100644 (file)
@@ -247,7 +247,7 @@ _("Inferior %d and inferior %d would have identical simulator state.\n"
 
   if (sim_data == NULL)
     {
-      sim_data = sim_inferior_data_key.emplace (inf, sim_desc);
+      sim_data = &sim_inferior_data_key.emplace (inf, sim_desc);
     }
   else if (sim_desc)
     {
index 1358e1c06b92205ea241f9b8e968eae36e206999..8bdc4951035a45a4e37738977ade6d4da39f09b5 100644 (file)
@@ -1729,7 +1729,7 @@ get_remote_progspace_info (program_space *pspace)
 {
   remote_per_progspace *info = remote_pspace_data.get (pspace);
   if (info == nullptr)
-    info = remote_pspace_data.emplace (pspace);
+    info = &remote_pspace_data.emplace (pspace);
   gdb_assert (info != nullptr);
   return *info;
 }
@@ -13101,7 +13101,7 @@ get_g_packet_data (struct gdbarch *gdbarch)
   struct remote_g_packet_data *data
     = remote_g_packet_data_handle.get (gdbarch);
   if (data == nullptr)
-    data = remote_g_packet_data_handle.emplace (gdbarch);
+    data = &remote_g_packet_data_handle.emplace (gdbarch);
   return data;
 }
 
index 1dd8e7080098ea61aebf428f8f2635d67177c4d3..6c403f9685d5d79ee70b3ebd4c508f5bdbe1c68e 100644 (file)
@@ -165,7 +165,7 @@ get_ppc_per_inferior (inferior *inf)
   ppc_inferior_data *per_inf = ppc_inferior_data_key.get (inf);
 
   if (per_inf == nullptr)
-    per_inf = ppc_inferior_data_key.emplace (inf);
+    per_inf = &ppc_inferior_data_key.emplace (inf);
 
   return per_inf;
 }
index 3c452e0d8055ffc63ed4f96232a39be57b705648..8f210312342d8cba39acdaf25c6cec4d242ae503 100644 (file)
@@ -100,7 +100,7 @@ get_solib_aix_inferior_data (struct inferior *inf)
 
   data = solib_aix_inferior_data_handle.get (inf);
   if (data == NULL)
-    data = solib_aix_inferior_data_handle.emplace (inf);
+    data = &solib_aix_inferior_data_handle.emplace (inf);
 
   return data;
 }
index c23b8e6eb9721f565789bf3cce9a08525c21579b..0a6e023128e47c6f72b4985934268bc1703e04c7 100644 (file)
@@ -106,7 +106,7 @@ get_darwin_info (program_space *pspace)
   if (info != nullptr)
     return info;
 
-  return solib_darwin_pspace_data.emplace (pspace);
+  return &solib_darwin_pspace_data.emplace (pspace);
 }
 
 /* Return non-zero if the version in dyld_all_image is known.  */
index 17c8e565ee1d769a7b8ec89248b9a30b6ef3c7a9..aed7e4ea28e301a3cf2fd8fb2a6f1184a1dbb511 100644 (file)
@@ -202,7 +202,7 @@ get_dsbt_info (program_space *pspace)
   if (info != nullptr)
     return info;
 
-  return solib_dsbt_pspace_data.emplace (pspace);
+  return &solib_dsbt_pspace_data.emplace (pspace);
 }
 
 
index ced7c64499928f0e7710767bcb2d94e39b803855..2ffccb69be2a3ae57e8063fd9901d4393d6e04a1 100644 (file)
@@ -235,7 +235,7 @@ get_solib_info (inferior *inf)
   solib_info *info = rocm_solib_data.get (inf);
 
   if (info == nullptr)
-    info = rocm_solib_data.emplace (inf, inf);
+    info = &rocm_solib_data.emplace (inf, inf);
 
   return info;
 }
index 8beb545fd9a7eea23b88d41c027039cba04fae92..49b005beb1a28e65fb68a99ea96faabd2af49189 100644 (file)
@@ -471,7 +471,7 @@ get_svr4_info (program_space *pspace)
   struct svr4_info *info = solib_svr4_pspace_data.get (pspace);
 
   if (info == NULL)
-    info = solib_svr4_pspace_data.emplace (pspace);
+    info = &solib_svr4_pspace_data.emplace (pspace);
 
   return info;
 }
index ade1bb2789f953aa4305851f4fface47f06de4fc..825f09f5947941ddf5c71b1bf658b4311f11e1bc 100644 (file)
@@ -226,7 +226,7 @@ get_source_location (program_space *pspace)
   current_source_location *loc
     = current_source_key.get (pspace);
   if (loc == nullptr)
-    loc = current_source_key.emplace (pspace);
+    loc = &current_source_key.emplace (pspace);
   return loc;
 }
 
index eac0357abd5008a7d53ce19ab1604e8c8fce01ca..163985918a656f31e812f950526fef182fcf4f1e 100644 (file)
@@ -44,7 +44,7 @@ get_svr4_tls_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct svr4_tls_gdbarch_data *result = svr4_tls_gdbarch_data_handle.get (gdbarch);
   if (result == nullptr)
-    result = svr4_tls_gdbarch_data_handle.emplace (gdbarch);
+    result = &svr4_tls_gdbarch_data_handle.emplace (gdbarch);
   return result;
 }
 
index 35e380980b567722c08854c2c0880839e79d087f..37a9fe62f40a2be162f1d145688eb98b6e708bdc 100644 (file)
@@ -1318,7 +1318,7 @@ get_symbol_cache (struct program_space *pspace)
 
   if (cache == NULL)
     {
-      cache = symbol_cache_key.emplace (pspace);
+      cache = &symbol_cache_key.emplace (pspace);
       resize_symbol_cache (cache, symbol_cache_size);
     }
 
@@ -6290,7 +6290,7 @@ get_main_info (program_space *pspace)
         gdb returned "main" as the name even if no function named
         "main" was defined the program; and this approach lets us
         keep compatibility.  */
-      info = main_progspace_key.emplace (pspace);
+      info = &main_progspace_key.emplace (pspace);
     }
 
   return info;
index 0096263547ad1f38f9892b5b47dc64a75e506ec0..1c4bbe297c087f51efb464bd942449e4b54340c7 100644 (file)
@@ -445,7 +445,7 @@ get_arch_data (struct gdbarch *gdbarch)
 {
   tdesc_arch_data *result = tdesc_data.get (gdbarch);
   if (result == nullptr)
-    result = tdesc_data.emplace (gdbarch);
+    result = &tdesc_data.emplace (gdbarch);
   return result;
 }
 
index ad4c35ff8c6eaa883e4fd75bbe40ece87dfc8b34..6a8f26bf3e65315adb186e91e76557779c4fe416 100644 (file)
@@ -192,7 +192,7 @@ get_windows_gdbarch_data (struct gdbarch *gdbarch)
 {
   windows_gdbarch_data *result = windows_gdbarch_data_handle.get (gdbarch);
   if (result == nullptr)
-    result = windows_gdbarch_data_handle.emplace (gdbarch);
+    result = &windows_gdbarch_data_handle.emplace (gdbarch);
   return result;
 }