]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Constify property_addr_info
authorTom Tromey <tromey@adacore.com>
Wed, 16 Apr 2025 21:18:43 +0000 (15:18 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 6 May 2025 15:01:54 +0000 (09:01 -0600)
This changes most places to use a const property_addr_info.  This
seems more correct to me because normally the user of a
property_addr_info should not modify it.  Furthermore, some functions
already take a const object, and for a subsequent patch it is
convenient if other functions do as well.

gdb/dwarf2/loc.h
gdb/gdbtypes.c

index 30c528b525d69f36528818c169d9573fc97a18ee..02304121a881394805d7d8390fb23b8df1290e9d 100644 (file)
@@ -99,7 +99,7 @@ struct property_addr_info
 
   /* If not NULL, a pointer to the info for the object containing
      the object described by this node.  */
-  struct property_addr_info *next;
+  const property_addr_info *next;
 };
 
 /* Converts a dynamic property into a static one.  FRAME is the frame in which
index 5713eac7ffed39dddd7bdcf5fcc3d08641c00269..adb4e7291ab4d6aafde39414535f0bf2f09c2cc0 100644 (file)
@@ -2146,7 +2146,7 @@ is_dynamic_type (struct type *type)
 }
 
 static struct type *resolve_dynamic_type_internal
-  (struct type *type, struct property_addr_info *addr_stack,
+  (struct type *type, const property_addr_info *addr_stack,
    const frame_info_ptr &frame, bool top_level);
 
 /* Given a dynamic range type (dyn_range_type) and a stack of
@@ -2167,7 +2167,7 @@ static struct type *resolve_dynamic_type_internal
 
 static struct type *
 resolve_dynamic_range (struct type *dyn_range_type,
-                      struct property_addr_info *addr_stack,
+                      const property_addr_info *addr_stack,
                       const frame_info_ptr &frame,
                       int rank, bool resolve_p = true)
 {
@@ -2269,7 +2269,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
 
 static struct type *
 resolve_dynamic_array_or_string_1 (struct type *type,
-                                  struct property_addr_info *addr_stack,
+                                  const property_addr_info *addr_stack,
                                   const frame_info_ptr &frame,
                                   int rank, bool resolve_p)
 {
@@ -2397,7 +2397,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
 
 static struct type *
 resolve_dynamic_array_or_string (struct type *type,
-                                struct property_addr_info *addr_stack,
+                                const property_addr_info *addr_stack,
                                 const frame_info_ptr &frame)
 {
   CORE_ADDR value;
@@ -2490,7 +2490,7 @@ resolve_dynamic_array_or_string (struct type *type,
 
 static struct type *
 resolve_dynamic_union (struct type *type,
-                      struct property_addr_info *addr_stack,
+                      const property_addr_info *addr_stack,
                       const frame_info_ptr &frame)
 {
   struct type *resolved_type;
@@ -2534,7 +2534,7 @@ variant::matches (ULONGEST value, bool is_unsigned) const
 
 static void
 compute_variant_fields_inner (struct type *type,
-                             struct property_addr_info *addr_stack,
+                             const property_addr_info *addr_stack,
                              const variant_part &part,
                              std::vector<bool> &flags);
 
@@ -2549,7 +2549,7 @@ compute_variant_fields_inner (struct type *type,
 
 static void
 compute_variant_fields_recurse (struct type *type,
-                               struct property_addr_info *addr_stack,
+                               const property_addr_info *addr_stack,
                                const variant &variant,
                                std::vector<bool> &flags,
                                bool enabled)
@@ -2581,7 +2581,7 @@ compute_variant_fields_recurse (struct type *type,
 
 static void
 compute_variant_fields_inner (struct type *type,
-                             struct property_addr_info *addr_stack,
+                             const property_addr_info *addr_stack,
                              const variant_part &part,
                              std::vector<bool> &flags)
 {
@@ -2650,7 +2650,7 @@ compute_variant_fields_inner (struct type *type,
 static void
 compute_variant_fields (struct type *type,
                        struct type *resolved_type,
-                       struct property_addr_info *addr_stack,
+                       const property_addr_info *addr_stack,
                        const gdb::array_view<variant_part> &parts)
 {
   /* Assume all fields are included by default.  */
@@ -2682,7 +2682,7 @@ compute_variant_fields (struct type *type,
 
 static struct type *
 resolve_dynamic_struct (struct type *type,
-                       struct property_addr_info *addr_stack,
+                       const property_addr_info *addr_stack,
                        const frame_info_ptr &frame)
 {
   struct type *resolved_type;
@@ -2725,9 +2725,9 @@ resolve_dynamic_struct (struct type *type,
          struct dynamic_prop prop;
          prop.set_locexpr (&baton);
 
+         CORE_ADDR vals[1] = { addr_stack->addr };
          CORE_ADDR addr;
-         if (dwarf2_evaluate_property (&prop, frame, addr_stack, &addr,
-                                       {addr_stack->addr}))
+         if (dwarf2_evaluate_property (&prop, frame, addr_stack, &addr, vals))
            resolved_type->field (i).set_loc_bitpos
              (TARGET_CHAR_BIT * (addr - addr_stack->addr));
        }
@@ -2797,7 +2797,7 @@ resolve_dynamic_struct (struct type *type,
 
 static struct type *
 resolve_dynamic_type_internal (struct type *type,
-                              struct property_addr_info *addr_stack,
+                              const property_addr_info *addr_stack,
                               const frame_info_ptr &frame,
                               bool top_level)
 {