From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 1D687396E076 for ; Thu, 30 Apr 2020 18:17:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D687396E076 X-ASG-Debug-ID: 1588270674-0c856e18f311b5a70001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id pDRz1xMNr0Jp0v7I (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Apr 2020 14:17:54 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by smtp.ebox.ca (Postfix) with ESMTP id C8D05441D65; Thu, 30 Apr 2020 14:17:54 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-181-218.qc.cable.ebox.net[192.222.181.218] X-Barracuda-Apparent-Source-IP: 192.222.181.218 X-Barracuda-RBL-IP: 192.222.181.218 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/4] gdb: make add_dyn_prop a method of struct type Date: Thu, 30 Apr 2020 14:17:51 -0400 X-ASG-Orig-Subj: [PATCH 2/4] gdb: make add_dyn_prop a method of struct type Message-Id: <20200430181753.1093-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200430181753.1093-1-simon.marchi@efficios.com> References: <20200430181753.1093-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1588270674 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 5790 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81535 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-39.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 18:17:57 -0000 Move add_dyn_prop, currently a free function, to be a method of struct type. gdb/ChangeLog: * gdbtypes.h (struct type) : New method. (add_dyn_prop): Remove. Update all users to use type::add_dyn_prop. * gdbtypes.c (add_dyn_prop): Rename to... (type::add_dyn_prop): ... this. --- gdb/dwarf2/read.c | 12 ++++++------ gdb/gdbtypes.c | 13 ++++++------- gdb/gdbtypes.h | 14 ++++++-------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1813085d0d7..ac208991ff7 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9218,7 +9218,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type, prop.kind = PROP_VARIANT_PARTS; prop.data.variant_parts = prop_value; - add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop, type); + type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop); } /* Some versions of rustc emitted enums in an unusual way. @@ -14706,7 +14706,7 @@ add_variant_property (struct field_info *fip, struct type *type, = ((gdb::array_view *) obstack_copy (&objfile->objfile_obstack, &parts, sizeof (parts))); - add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop, type); + type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop); } /* Create the vector of fields, and attach it to the type. */ @@ -15355,7 +15355,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) struct dynamic_prop prop; if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->per_cu->addr_type ())) - add_dyn_prop (DYN_PROP_BYTE_SIZE, prop, type); + type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop); TYPE_LENGTH (type) = 0; } } @@ -23605,7 +23605,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct type *prop_type = cu->per_cu->addr_sized_int_type (false); if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) - add_dyn_prop (DYN_PROP_ALLOCATED, prop, type); + type->add_dyn_prop (DYN_PROP_ALLOCATED, prop); } else if (attr != NULL) { @@ -23620,7 +23620,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct type *prop_type = cu->per_cu->addr_sized_int_type (false); if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) - add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type); + type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop); } else if (attr != NULL) { @@ -23633,7 +23633,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_data_location, cu); if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->per_cu->addr_type ())) - add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type); + type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop); if (dwarf2_per_objfile->die_type_hash == NULL) dwarf2_per_objfile->die_type_hash diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9efcfea1ef9..3fc14e9cfb9 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1278,7 +1278,7 @@ create_array_type_with_stride (struct type *result_type, (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)); TYPE_INDEX_TYPE (result_type) = range_type; if (byte_stride_prop != NULL) - add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop, result_type); + result_type->add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop); else if (bit_stride > 0) TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride; @@ -2650,20 +2650,19 @@ type::get_dyn_prop (dynamic_prop_node_kind prop_kind) const /* See gdbtypes.h */ void -add_dyn_prop (enum dynamic_prop_node_kind prop_kind, struct dynamic_prop prop, - struct type *type) +type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop) { struct dynamic_prop_list *temp; - gdb_assert (TYPE_OBJFILE_OWNED (type)); + gdb_assert (TYPE_OBJFILE_OWNED (this)); - temp = XOBNEW (&TYPE_OBJFILE (type)->objfile_obstack, + temp = XOBNEW (&TYPE_OBJFILE (this)->objfile_obstack, struct dynamic_prop_list); temp->prop_kind = prop_kind; temp->prop = prop; - temp->next = TYPE_DYN_PROP_LIST (type); + temp->next = TYPE_DYN_PROP_LIST (this); - TYPE_DYN_PROP_LIST (type) = temp; + TYPE_DYN_PROP_LIST (this) = temp; } /* Remove dynamic property from TYPE in case it exists. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index a56570726fe..cd03f921d80 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -890,6 +890,12 @@ struct type list of dynamic properties. */ dynamic_prop *get_dyn_prop (dynamic_prop_node_kind kind) const; + /* * Given a dynamic property PROP of a given KIND, add this dynamic + property to this type. + + This function assumes that this type is objfile-owned. */ + void add_dyn_prop (dynamic_prop_node_kind kind, dynamic_prop prop); + /* * Type that is a pointer to this type. NULL if no such pointer-to type is known yet. The debugger may add the address of such a type @@ -2109,14 +2115,6 @@ extern struct type *resolve_dynamic_type /* * Predicate if the type has dynamic values, which are not resolved yet. */ extern int is_dynamic_type (struct type *type); -/* * Given a dynamic property PROP of a given KIND, add this dynamic - property to the given TYPE. - - This function assumes that TYPE is objfile-owned. */ -extern void add_dyn_prop - (enum dynamic_prop_node_kind kind, struct dynamic_prop prop, - struct type *type); - extern void remove_dyn_prop (enum dynamic_prop_node_kind prop_kind, struct type *type); -- 2.26.2