[applied,to,master] ir,{btf,ctf,dwarf}-reader: Rename {subrange_type,array_type_def}::is_infinite.

Message ID 87plwuuft4.fsf@redhat.com
State New
Headers
Series [applied,to,master] ir,{btf,ctf,dwarf}-reader: Rename {subrange_type,array_type_def}::is_infinite. |

Commit Message

Dodji Seketeli Feb. 18, 2024, 12:17 p.m. UTC
  Hello,

Rename subrange_type::is_infinite into subrange_type::is_non_finite
for better legibility.

	* include/abg-ir.h
	({array_type_def,subrange_type}::is_non_finite): Rename
	{array_type_def,subrange_type}::is_infinite into this.
	* src/abg-btf-reader.cc (reader::build_array_type): Add a missing
	call to subrange_type::is_non_finite.
	* src/abg-comp-filter.cc
	(is_var_1_dim_unknown_size_array_change):Rename
	subrange_type::is_infinite into subrange_type::is_non_finite.
	* src/abg-ctf-reader.cc (build_array_ctf_range): Likewise.
	* src/abg-dwarf-reader.cc (build_subrange_type): Likewise.
	* src/abg-ir.cc (clone_array, has_flexible_array_data_member)
	(array_type_def::subrange_type::as_string): Likewise.
	({array_type_def,subrange_type}::is_non_finite): Rename
	{array_type_def,subrange_type}::is_infinite into this.
	* src/abg-reader.cc (build_subrange_type): Rename
	subrange_type::is_infinite into subrange_type::is_non_finite.
	* src/abg-reporter-priv.cc (report_size_and_alignment_changes):
	Likewise.
	* src/abg-writer.cc (write_array_size_and_alignment): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch.
---
 include/abg-ir.h         |  6 +++---
 src/abg-btf-reader.cc    |  1 +
 src/abg-comp-filter.cc   |  2 +-
 src/abg-ctf-reader.cc    |  6 +++---
 src/abg-dwarf-reader.cc  | 10 +++++-----
 src/abg-ir.cc            | 16 ++++++++--------
 src/abg-reader.cc        | 10 +++++-----
 src/abg-reporter-priv.cc |  8 ++++----
 src/abg-writer.cc        |  6 +++---
 9 files changed, 33 insertions(+), 32 deletions(-)
  

Patch

diff --git a/include/abg-ir.h b/include/abg-ir.h
index 964d1397..90f5d4d3 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -2624,10 +2624,10 @@  public:
     get_length() const;
 
     bool
-    is_infinite() const;
+    is_non_finite() const;
 
     void
-    is_infinite(bool);
+    is_non_finite(bool);
 
     translation_unit::language
     get_language() const;
@@ -2701,7 +2701,7 @@  public:
   get_dimension_count() const;
 
   virtual bool
-  is_infinite() const;
+  is_non_finite() const;
 
   virtual string
   get_pretty_representation(bool internal = false,
diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc
index 0e949ef5..1252fed1 100644
--- a/src/abg-btf-reader.cc
+++ b/src/abg-btf-reader.cc
@@ -797,6 +797,7 @@  public:
 					   (env(), /*name=*/"",
 					    lower_bound, upper_bound,
 					    location()));
+    subrange->is_non_finite(!arr->nelems);
     add_decl_to_scope(subrange, cur_tu()->get_global_scope());
     canonicalize(subrange);
     array_type_def::subranges_type subranges = {subrange};
diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc
index 82a819d6..63716775 100644
--- a/src/abg-comp-filter.cc
+++ b/src/abg-comp-filter.cc
@@ -667,7 +667,7 @@  is_var_1_dim_unknown_size_array_change(const var_decl_sptr& var1,
   // be of unknown size.
   if (fat->get_subranges().size() != 1
       || sat->get_subranges().size() != 1
-      || (!fat->is_infinite() && !sat->is_infinite()))
+      || (!fat->is_non_finite() && !sat->is_non_finite()))
     return false;
 
   // The variables must be equal modulo their type.
diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc
index 2de11c0f..08570adc 100644
--- a/src/abg-ctf-reader.cc
+++ b/src/abg-ctf-reader.cc
@@ -1231,7 +1231,7 @@  static array_type_def::subrange_sptr
 build_array_ctf_range(reader *rdr, ctf_dict_t *dic,
                       ctf_id_t index, uint64_t nelems)
 {
-  bool is_infinite = false;
+  bool is_non_finite = false;
   corpus_sptr corp = rdr->corpus();
   translation_unit_sptr tunit = rdr->cur_transl_unit();
   array_type_def::subrange_sptr subrange;
@@ -1247,7 +1247,7 @@  build_array_ctf_range(reader *rdr, ctf_dict_t *dic,
 
   /* for VLAs number of array elements is 0 */
   if (upper_bound.get_unsigned_value() == 0 && nelems == 0)
-    is_infinite = true;
+    is_non_finite = true;
 
   subrange.reset(new array_type_def::subrange_type(rdr->env(),
                                                    "",
@@ -1259,7 +1259,7 @@  build_array_ctf_range(reader *rdr, ctf_dict_t *dic,
   if (!subrange)
     return nullptr;
 
-  subrange->is_infinite(is_infinite);
+  subrange->is_non_finite(is_non_finite);
   add_decl_to_scope(subrange, tunit->get_global_scope());
   canonicalize(subrange);
 
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index f836fcff..6d64c0c7 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -14370,7 +14370,7 @@  build_subrange_type(reader&		rdr,
     get_default_array_lower_bound(language);
   array_type_def::subrange_type::bound_value upper_bound;
   uint64_t count = 0;
-  bool is_infinite = false;
+  bool is_non_finite = false;
   bool non_zero_count_present = false;
 
   // The DWARF 4 specifications says, in [5.11 Subrange
@@ -14427,13 +14427,13 @@  build_subrange_type(reader&		rdr,
 	// No upper_bound nor count was present on the DIE, this means
 	// the array is considered to have an infinite (or rather not
 	// known) size.
-	is_infinite = true;
+	is_non_finite = true;
     }
 
   if (UINT64_MAX == upper_bound.get_unsigned_value())
     // If the upper_bound size is the max of the integer value
     // then it most certainly means unknown size.
-    is_infinite = true;
+    is_non_finite = true;
 
   result.reset
     (new array_type_def::subrange_type(rdr.env(),
@@ -14441,13 +14441,13 @@  build_subrange_type(reader&		rdr,
 				       lower_bound,
 				       upper_bound,
 				       location()));
-  result->is_infinite(is_infinite);
+  result->is_non_finite(is_non_finite);
 
   if (underlying_type)
     result->set_underlying_type(underlying_type);
 
   // Let's ensure the resulting subrange looks metabolically healhty.
-  ABG_ASSERT(result->is_infinite()
+  ABG_ASSERT(result->is_non_finite()
 	     || (result->get_length() ==
 		 (uint64_t) (result->get_upper_bound()
 			     - result->get_lower_bound() + 1)));
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 9f053aef..162f4c0a 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -7630,7 +7630,7 @@  clone_array(const array_type_def_sptr& array)
 					   (*i)->get_underlying_type(),
 					   (*i)->get_location(),
 					   (*i)->get_language()));
-      subrange->is_infinite((*i)->is_infinite());
+      subrange->is_non_finite((*i)->is_non_finite());
       if (scope_decl *scope = (*i)->get_scope())
 	add_decl_to_scope(subrange, scope);
       subranges.push_back(subrange);
@@ -10870,7 +10870,7 @@  has_flexible_array_data_member(const class_decl& klass)
 
   if (array_type_def_sptr array = is_array_type(dms.back()->get_type()))
     {// The type of the last data member is an array.
-      if (array->is_infinite())
+      if (array->is_non_finite())
 	// The array has a non-finite size.  We are thus looking at a
 	// flexible array data member.  Let's return it.
 	return dms.back();
@@ -18825,7 +18825,7 @@  array_type_def::subrange_type::set_lower_bound(int64_t lb)
 uint64_t
 array_type_def::subrange_type::get_length() const
 {
-  if (is_infinite())
+  if (is_non_finite())
     return 0;
 
   // A subrange can have an upper bound that is lower than its lower
@@ -18840,7 +18840,7 @@  array_type_def::subrange_type::get_length() const
 ///
 /// @return true iff the length of the subrange type is infinite.
 bool
-array_type_def::subrange_type::is_infinite() const
+array_type_def::subrange_type::is_non_finite() const
 {return priv_->infinite_;}
 
 /// Set the infinite-ness status of the subrange type.
@@ -18848,7 +18848,7 @@  array_type_def::subrange_type::is_infinite() const
 /// @param f true iff the length of the subrange type should be set to
 /// being infinite.
 void
-array_type_def::subrange_type::is_infinite(bool f)
+array_type_def::subrange_type::is_non_finite(bool f)
 {priv_->infinite_ = f;}
 
 /// Getter of the language that generated this type.
@@ -18873,7 +18873,7 @@  array_type_def::subrange_type::as_string() const
 	o << ir::get_pretty_representation(underlying_type, false) << " ";
       o << "range "<< get_lower_bound() << " .. " << get_upper_bound();
     }
-  else if (is_infinite())
+  else if (is_non_finite())
     o << "[]";
   else
     o << "["  << get_length() << "]";
@@ -19388,7 +19388,7 @@  array_type_def::append_subranges(const std::vector<subrange_sptr>& subs)
 /// if the array has no sub-range at all, also meaning that the size
 /// of the array is infinite.
 bool
-array_type_def::is_infinite() const
+array_type_def::is_non_finite() const
 {
   if (priv_->subranges_.empty())
     return true;
@@ -19397,7 +19397,7 @@  array_type_def::is_infinite() const
 	 priv_->subranges_.begin();
        i != priv_->subranges_.end();
        ++i)
-    if ((*i)->is_infinite())
+    if ((*i)->is_non_finite())
       return true;
 
   return false;
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 91f6fcd5..096aa862 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -4405,11 +4405,11 @@  build_subrange_type(reader&		rdr,
 
   uint64_t length = 0;
   string length_str;
-  bool is_infinite = false;
+  bool is_non_finite = false;
   if (xml_char_sptr s = XML_NODE_GET_ATTRIBUTE(node, "length"))
     {
       if (string(CHAR_STR(s)) == "infinite" || string(CHAR_STR(s)) == "unknown")
-	is_infinite = true;
+	is_non_finite = true;
       else
 	length = strtoull(CHAR_STR(s), NULL, 0);
     }
@@ -4423,7 +4423,7 @@  build_subrange_type(reader&		rdr,
       if (!string(CHAR_STR(s)).empty())
 	upper_bound = strtoll(CHAR_STR(s), NULL, 0);
       bounds_present = true;
-      ABG_ASSERT(is_infinite
+      ABG_ASSERT(is_non_finite
 		 || (length == (uint64_t) upper_bound - lower_bound + 1));
     }
 
@@ -4446,7 +4446,7 @@  build_subrange_type(reader&		rdr,
   // IR would reflect that, so let's stay compatible with that.
   array_type_def::subrange_type::bound_value max_bound;
   array_type_def::subrange_type::bound_value min_bound;
-  if (!is_infinite)
+  if (!is_non_finite)
     if (length > 0)
       // By default, if no 'lower-bound/upper-bound' attributes are
       // set, we assume that the lower bound is 0 and the upper bound
@@ -4466,7 +4466,7 @@  build_subrange_type(reader&		rdr,
 				       name, min_bound, max_bound,
 				       underlying_type, loc));
   maybe_set_artificial_location(rdr, node, p);
-  p->is_infinite(is_infinite);
+  p->is_non_finite(is_non_finite);
 
   if (rdr.push_and_key_type_decl(p, node, add_to_current_scope))
     rdr.map_xml_node_to_decl(node, p);
diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc
index c8122af3..581c6f72 100644
--- a/src/abg-reporter-priv.cc
+++ b/src/abg-reporter-priv.cc
@@ -837,12 +837,12 @@  report_size_and_alignment_changes(type_or_decl_base_sptr	first,
 	      // We are looking at size or alignment changes between two
 	      // arrays ...
 	      out << indent << "array type size changed from ";
-	      if (first_array->is_infinite())
+	      if (first_array->is_non_finite())
 		out << "\'unknown\'";
 	      else
 		emit_num_value(first_array->get_size_in_bits(), *ctxt, out);
 	      out << " to ";
-	      if (second_array->is_infinite())
+	      if (second_array->is_non_finite())
 		out << "\'unknown\'";
 	      else
 		emit_num_value(second_array->get_size_in_bits(), *ctxt, out);
@@ -871,14 +871,14 @@  report_size_and_alignment_changes(type_or_decl_base_sptr	first,
 			  << i - first_array->get_subranges().begin() + 1
 			  << " changed length from ";
 
-		      if ((*i)->is_infinite())
+		      if ((*i)->is_non_finite())
 			out << "\'unknown\'";
 		      else
 			out << (*i)->get_length();
 
 		      out << " to ";
 
-		      if ((*j)->is_infinite())
+		      if ((*j)->is_non_finite())
 			out << "\'unknown\'";
 		      else
 			out << (*j)->get_length();
diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 24616364..46b5e67f 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -1511,7 +1511,7 @@  write_size_and_alignment(const shared_ptr<type_base> decl, ostream& o,
 static void
 write_array_size_and_alignment(const shared_ptr<array_type_def> decl, ostream& o)
 {
-  if (decl->is_infinite())
+  if (decl->is_non_finite())
     o << " size-in-bits='" << "unknown" << "'";
   else {
     size_t size_in_bits = decl->get_size_in_bits();
@@ -3015,14 +3015,14 @@  write_array_subrange_type(const array_type_def::subrange_sptr&	decl,
     o << " name='" << decl->get_name() << "'";
 
   o << " length='";
-  if (decl->is_infinite())
+  if (decl->is_non_finite())
     o << "unknown";
   else
     o << decl->get_length();
 
   o << "'";
 
-  ABG_ASSERT(decl->is_infinite()
+  ABG_ASSERT(decl->is_non_finite()
 	     || decl->get_length() == 0
 	     || (decl->get_length() ==
 		 (uint64_t) (decl->get_upper_bound()