This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref


Renamed dwarf form predicate function to match the naming schema.
Grouped functions.

gdb:

2013-07-24  Sanimir Agovic  <sanimir.agovi@intel.com>

	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
	All uses updated.

Change-Id: I3df124bebcd491dfd55f64dc7d83ce7c4ecc79f5
---
 gdb/dwarf2read.c |   65 +++++++++++++++++++++++++++--------------------------
 1 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 94727a7..1ee36bb 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1608,8 +1608,6 @@ static void dump_die_1 (struct ui_file *, int level, int max_level,
 static void store_in_ref_table (struct die_info *,
 				struct dwarf2_cu *);
 
-static int is_ref_attr (struct attribute *);
-
 static sect_offset dwarf2_get_ref_die_offset (struct attribute *);
 
 static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int);
@@ -1657,6 +1655,8 @@ static int attr_form_is_section_offset (struct attribute *);
 
 static int attr_form_is_constant (struct attribute *);
 
+static int attr_form_is_ref (struct attribute *);
+
 static void fill_in_loclist_baton (struct dwarf2_cu *cu,
 				   struct dwarf2_loclist_baton *baton,
 				   struct attribute *attr);
@@ -10364,7 +10364,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
       SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton);
     }
-  else if (is_ref_attr (attr))
+  else if (attr_form_is_ref (attr))
     {
       struct dwarf2_cu *target_cu = cu;
       struct die_info *target_die;
@@ -10437,7 +10437,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
       loc = dwarf2_attr (child_die, DW_AT_location, cu);
       origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
-      if (loc == NULL && origin != NULL && is_ref_attr (origin))
+      if (loc == NULL && origin != NULL && attr_form_is_ref (origin))
 	{
 	  sect_offset offset;
 
@@ -13379,7 +13379,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
   if (attr)
     {
-      if (attr_form_is_block (attr) || is_ref_attr (attr))
+      if (attr_form_is_block (attr) || attr_form_is_ref (attr))
         {
           /* GCC encodes arrays with unspecified or dynamic length
              with a DW_FORM_block1 attribute or a reference attribute.
@@ -14820,7 +14820,7 @@ read_attribute_value (const struct die_reader_specs *reader,
     }
 
   /* Super hack.  */
-  if (cu->per_cu->is_dwz && is_ref_attr (attr))
+  if (cu->per_cu->is_dwz && attr_form_is_ref (attr))
     attr->form = DW_FORM_GNU_ref_alt;
 
   /* We have seen instances where the compiler tried to emit a byte
@@ -17078,7 +17078,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
       per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile);
       this_type = get_die_type_at_offset (offset, per_cu);
     }
-  else if (is_ref_attr (attr))
+  else if (attr_form_is_ref (attr))
     {
       sect_offset offset = dwarf2_get_ref_die_offset (attr);
 
@@ -17107,7 +17107,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
       struct die_info *type_die = NULL;
       struct dwarf2_cu *type_cu = cu;
 
-      if (is_ref_attr (attr))
+      if (attr_form_is_ref (attr))
 	type_die = follow_die_ref (die, attr, &type_cu);
       if (type_die == NULL)
 	return build_error_marker_type (cu, die);
@@ -17950,27 +17950,6 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu)
   *slot = die;
 }
 
-/* DW_ADDR is always stored already as sect_offset; despite for the forms
-   besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file.  */
-
-static int
-is_ref_attr (struct attribute *attr)
-{
-  switch (attr->form)
-    {
-    case DW_FORM_ref_addr:
-    case DW_FORM_ref1:
-    case DW_FORM_ref2:
-    case DW_FORM_ref4:
-    case DW_FORM_ref8:
-    case DW_FORM_ref_udata:
-    case DW_FORM_GNU_ref_alt:
-      return 1;
-    default:
-      return 0;
-    }
-}
-
 /* Return DIE offset of ATTR.  Return 0 with complaint if ATTR is not of the
    required kind.  */
 
@@ -17979,7 +17958,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
 {
   sect_offset retval = { DW_UNSND (attr) };
 
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     return retval;
 
   retval.sect_off = 0;
@@ -18022,7 +18001,7 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr,
 {
   struct die_info *die;
 
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     die = follow_die_ref (src_die, attr, ref_cu);
   else if (attr->form == DW_FORM_ref_sig8)
     die = follow_die_sig (src_die, attr, ref_cu);
@@ -18505,7 +18484,7 @@ get_DW_AT_signature_type (struct die_info *die, struct attribute *attr,
 			  struct dwarf2_cu *cu) /* ARI: editCase function */
 {
   /* Yes, DW_AT_signature can use a non-ref_sig8 reference.  */
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     {
       struct dwarf2_cu *type_cu = cu;
       struct die_info *type_die = follow_die_ref (die, attr, &type_cu);
@@ -19873,6 +19852,28 @@ attr_form_is_constant (struct attribute *attr)
     }
 }
 
+
+/* DW_ADDR is always stored already as sect_offset; despite for the forms
+   besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file.  */
+
+static int
+attr_form_is_ref (struct attribute *attr)
+{
+  switch (attr->form)
+    {
+    case DW_FORM_ref_addr:
+    case DW_FORM_ref1:
+    case DW_FORM_ref2:
+    case DW_FORM_ref4:
+    case DW_FORM_ref8:
+    case DW_FORM_ref_udata:
+    case DW_FORM_GNU_ref_alt:
+      return 1;
+    default:
+      return 0;
+    }
+}
+
 /* Return the .debug_loc section to use for CU.
    For DWO files use .debug_loc.dwo.  */
 
-- 
1.7.1.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]