[v3,14/21] Remove suppression types' priv class methods.

Message ID 20200424092132.150547-15-gprocida@google.com
State Superseded
Headers
Series Simplify regex and suppression parsing. |

Commit Message

Giuliano Procida April 24, 2020, 9:21 a.m. UTC
  The type_suppression::set_type_name_not_regex method is the only
remaining user of all the various suppression_type::priv member
functions. This is easily remedied and all the remaining priv member
functions (regex getters and setters) can be dropped.

This patches leaves all the various suppression priv types as simple
data containers (modulo their constructors).

There are no behavioural changes.

	* src/abg-suppression-priv.h (suppression_base::priv): Drop
	all regex getter methods.
	(function_suppression::parameter_spec::priv): Drop all regex
	getter methods.
	(function_suppression::priv): Drop all regex getter methods.
	(variable_suppression::priv): Drop all regex getter methods.
	(type_suppression::priv): Drop all regex getter and setter
	methods.
	* src/abg-suppression.cc (set_type_name_not_regex): Access
	priv_->type_name_not_regex_ directly.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-suppression-priv.h | 182 -------------------------------------
 src/abg-suppression.cc     |   2 +-
 2 files changed, 1 insertion(+), 183 deletions(-)
  

Comments

Matthias Männich April 27, 2020, 11:57 a.m. UTC | #1
On Fri, Apr 24, 2020 at 10:21:25AM +0100, Giuliano Procida wrote:
>The type_suppression::set_type_name_not_regex method is the only
>remaining user of all the various suppression_type::priv member
>functions. This is easily remedied and all the remaining priv member
>functions (regex getters and setters) can be dropped.
>
>This patches leaves all the various suppression priv types as simple
>data containers (modulo their constructors).
>
>There are no behavioural changes.
>
>	* src/abg-suppression-priv.h (suppression_base::priv): Drop
>	all regex getter methods.
>	(function_suppression::parameter_spec::priv): Drop all regex
>	getter methods.
>	(function_suppression::priv): Drop all regex getter methods.
>	(variable_suppression::priv): Drop all regex getter methods.
>	(type_suppression::priv): Drop all regex getter and setter
>	methods.
>	* src/abg-suppression.cc (set_type_name_not_regex): Access
>	priv_->type_name_not_regex_ directly.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>---
> src/abg-suppression-priv.h | 182 -------------------------------------
> src/abg-suppression.cc     |   2 +-
> 2 files changed, 1 insertion(+), 183 deletions(-)
>
>diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
>index 5c06d5d0..78f11e2f 100644
>--- a/src/abg-suppression-priv.h
>+++ b/src/abg-suppression-priv.h
>@@ -75,38 +75,6 @@ public:
>   {}
>
>   friend class suppression_base;
>-
>-  /// Get the regular expression object associated to the
>-  /// 'file_name_regex' property of @ref suppression_base.
>-  const regex::regex_t_sptr&
>-  get_file_name_regex() const
>-  {
>-    return file_name_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'file_name_not_regex' property of @ref suppression_base.
>-  const regex::regex_t_sptr&
>-  get_file_name_not_regex() const
>-  {
>-    return file_name_not_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the 'soname_regex'
>-  /// property of @ref suppression_base.
>-  const regex::regex_t_sptr&
>-  get_soname_regex() const
>-  {
>-    return soname_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'soname_not_regex' property of @ref suppression_base.
>-  const regex::regex_t_sptr&
>-  get_soname_not_regex() const
>-  {
>-    return soname_not_regex_;
>-  }
> }; // end class suppression_base::priv
>
> // </suppression_base stuff>
>@@ -133,15 +101,6 @@ class function_suppression::parameter_spec::priv
>   priv(size_t i, const string& tn, const regex::regex_t_sptr& tn_regex)
>     : index_(i), type_name_(tn), type_name_regex_(tn_regex)
>   {}
>-
>-  /// Get the regular expression object associated to the
>-  /// 'type_name_regex' property of @ref
>-  /// function_suppression::parameter_spec.
>-  const regex::regex_t_sptr
>-  get_type_name_regex() const
>-  {
>-    return type_name_regex_;
>-  }
> }; // end class function_suppression::parameter_spec::priv
>
>
>@@ -191,54 +150,6 @@ struct function_suppression::priv
>       symbol_version_regex_(symbol_version_regex),
>       allow_other_aliases_(true)
>   {}
>-
>-  /// Get the regular expression object associated to the 'name_regex'
>-  /// property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_name_regex() const
>-  {
>-    return name_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'name_not_regex' property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_name_not_regex() const
>-  {
>-    return name_not_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'return_type_regex' property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_return_type_regex() const
>-  {
>-    return return_type_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_name_regex' property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_name_regex() const
>-  {
>-    return symbol_name_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_name_not_regex' property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_name_not_regex() const
>-  {
>-    return symbol_name_not_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_version_regex' property of @ref function_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_version_regex() const
>-  {
>-    return symbol_version_regex_;
>-  }
> }; // end class function_suppression::priv
>
> bool
>@@ -343,54 +254,6 @@ struct variable_suppression::priv
>       type_name_(type_name),
>       type_name_regex_(type_name_regex)
>   {}
>-
>-  /// Get the regular expression object associated to the 'name_regex'
>-  /// property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_name_regex() const
>-  {
>-    return name_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'name_not_regex' property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_name_not_regex() const
>-  {
>-    return name_not_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_name_regex' property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_name_regex() const
>-  {
>-    return symbol_name_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_name_not_regex' property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_name_not_regex() const
>-  {
>-    return symbol_name_not_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'symbol_version_regex' property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_symbol_version_regex()  const
>-  {
>-    return symbol_version_regex_;
>-  }
>-
>-  /// Get the regular expression object associated to the
>-  /// 'type_name_regex' property of @ref variable_suppression.
>-  const regex::regex_t_sptr
>-  get_type_name_regex() const
>-  {
>-    return type_name_regex_;
>-  }
> };// end class variable_supppression::priv
>
> template <typename ReadContextType>
>@@ -454,51 +317,6 @@ public:
>       reach_kind_(reach_kind)
>   {}
>
>-  /// Get the regular expression object associated to the
>-  /// 'type_name_regex' property of @ref type_suppression.
>-  const regex::regex_t_sptr
>-  get_type_name_regex() const
>-  {
>-    return type_name_regex_;
>-  }
>-
>-  /// Setter for the type_name_regex object.
>-  ///
>-  /// @param r the new type_name_regex object.
>-  void
>-  set_type_name_regex(regex::regex_t_sptr r)
>-  {type_name_regex_ = r;}
>-
>-  /// Get the regular expression object associated to the
>-  /// 'type_name_not_regex' property of @ref type_suppression.
>-  const regex::regex_t_sptr
>-  get_type_name_not_regex() const
>-  {
>-    return type_name_not_regex_;
>-  }
>-
>-  /// Setter for the type_name_not_regex object.
>-  ///
>-  /// @param r the new type_name_not_regex object.
>-  void
>-  set_type_name_not_regex(regex::regex_t_sptr r)
>-  {type_name_not_regex_ = r;}
>-
>-  /// Get the regular expression object associated to the
>-  /// 'source_location_to_keep_regex' property of @ref type_suppression.
>-  const regex::regex_t_sptr
>-  get_source_location_to_keep_regex() const
>-  {
>-    return source_location_to_keep_regex_;
>-  }
>-
>-  /// Setter for the source_location_to_keep_regex object.
>-  ///
>-  /// @param r the new regex object.
>-  void
>-  set_source_location_to_keep_regex(regex::regex_t_sptr r)
>-  {source_location_to_keep_regex_ = r;}
>-
>   friend class type_suppression;
> }; // class type_suppression::priv
>
>diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
>index 191c65c6..331995bf 100644
>--- a/src/abg-suppression.cc
>+++ b/src/abg-suppression.cc
>@@ -515,7 +515,7 @@ type_suppression::get_type_name_regex() const
> /// @param r the new regexp string.
> void
> type_suppression::set_type_name_not_regex(const regex_t_sptr& r)
>-{priv_->set_type_name_not_regex(r);}
>+{priv_->type_name_not_regex_ = r;}
>
> /// Getter for the "type_name_not_regex" property of the type
> /// suppression specification.
>-- 
>2.26.2.303.gf8c07b1a785-goog
>
  

Patch

diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
index 5c06d5d0..78f11e2f 100644
--- a/src/abg-suppression-priv.h
+++ b/src/abg-suppression-priv.h
@@ -75,38 +75,6 @@  public:
   {}
 
   friend class suppression_base;
-
-  /// Get the regular expression object associated to the
-  /// 'file_name_regex' property of @ref suppression_base.
-  const regex::regex_t_sptr&
-  get_file_name_regex() const
-  {
-    return file_name_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'file_name_not_regex' property of @ref suppression_base.
-  const regex::regex_t_sptr&
-  get_file_name_not_regex() const
-  {
-    return file_name_not_regex_;
-  }
-
-  /// Get the regular expression object associated to the 'soname_regex'
-  /// property of @ref suppression_base.
-  const regex::regex_t_sptr&
-  get_soname_regex() const
-  {
-    return soname_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'soname_not_regex' property of @ref suppression_base.
-  const regex::regex_t_sptr&
-  get_soname_not_regex() const
-  {
-    return soname_not_regex_;
-  }
 }; // end class suppression_base::priv
 
 // </suppression_base stuff>
@@ -133,15 +101,6 @@  class function_suppression::parameter_spec::priv
   priv(size_t i, const string& tn, const regex::regex_t_sptr& tn_regex)
     : index_(i), type_name_(tn), type_name_regex_(tn_regex)
   {}
-
-  /// Get the regular expression object associated to the
-  /// 'type_name_regex' property of @ref
-  /// function_suppression::parameter_spec.
-  const regex::regex_t_sptr
-  get_type_name_regex() const
-  {
-    return type_name_regex_;
-  }
 }; // end class function_suppression::parameter_spec::priv
 
 
@@ -191,54 +150,6 @@  struct function_suppression::priv
       symbol_version_regex_(symbol_version_regex),
       allow_other_aliases_(true)
   {}
-
-  /// Get the regular expression object associated to the 'name_regex'
-  /// property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_name_regex() const
-  {
-    return name_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'name_not_regex' property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_name_not_regex() const
-  {
-    return name_not_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'return_type_regex' property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_return_type_regex() const
-  {
-    return return_type_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_name_regex' property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_symbol_name_regex() const
-  {
-    return symbol_name_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_name_not_regex' property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_symbol_name_not_regex() const
-  {
-    return symbol_name_not_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_version_regex' property of @ref function_suppression.
-  const regex::regex_t_sptr
-  get_symbol_version_regex() const
-  {
-    return symbol_version_regex_;
-  }
 }; // end class function_suppression::priv
 
 bool
@@ -343,54 +254,6 @@  struct variable_suppression::priv
       type_name_(type_name),
       type_name_regex_(type_name_regex)
   {}
-
-  /// Get the regular expression object associated to the 'name_regex'
-  /// property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_name_regex() const
-  {
-    return name_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'name_not_regex' property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_name_not_regex() const
-  {
-    return name_not_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_name_regex' property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_symbol_name_regex() const
-  {
-    return symbol_name_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_name_not_regex' property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_symbol_name_not_regex() const
-  {
-    return symbol_name_not_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'symbol_version_regex' property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_symbol_version_regex()  const
-  {
-    return symbol_version_regex_;
-  }
-
-  /// Get the regular expression object associated to the
-  /// 'type_name_regex' property of @ref variable_suppression.
-  const regex::regex_t_sptr
-  get_type_name_regex() const
-  {
-    return type_name_regex_;
-  }
 };// end class variable_supppression::priv
 
 template <typename ReadContextType>
@@ -454,51 +317,6 @@  public:
       reach_kind_(reach_kind)
   {}
 
-  /// Get the regular expression object associated to the
-  /// 'type_name_regex' property of @ref type_suppression.
-  const regex::regex_t_sptr
-  get_type_name_regex() const
-  {
-    return type_name_regex_;
-  }
-
-  /// Setter for the type_name_regex object.
-  ///
-  /// @param r the new type_name_regex object.
-  void
-  set_type_name_regex(regex::regex_t_sptr r)
-  {type_name_regex_ = r;}
-
-  /// Get the regular expression object associated to the
-  /// 'type_name_not_regex' property of @ref type_suppression.
-  const regex::regex_t_sptr
-  get_type_name_not_regex() const
-  {
-    return type_name_not_regex_;
-  }
-
-  /// Setter for the type_name_not_regex object.
-  ///
-  /// @param r the new type_name_not_regex object.
-  void
-  set_type_name_not_regex(regex::regex_t_sptr r)
-  {type_name_not_regex_ = r;}
-
-  /// Get the regular expression object associated to the
-  /// 'source_location_to_keep_regex' property of @ref type_suppression.
-  const regex::regex_t_sptr
-  get_source_location_to_keep_regex() const
-  {
-    return source_location_to_keep_regex_;
-  }
-
-  /// Setter for the source_location_to_keep_regex object.
-  ///
-  /// @param r the new regex object.
-  void
-  set_source_location_to_keep_regex(regex::regex_t_sptr r)
-  {source_location_to_keep_regex_ = r;}
-
   friend class type_suppression;
 }; // class type_suppression::priv
 
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 191c65c6..331995bf 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -515,7 +515,7 @@  type_suppression::get_type_name_regex() const
 /// @param r the new regexp string.
 void
 type_suppression::set_type_name_not_regex(const regex_t_sptr& r)
-{priv_->set_type_name_not_regex(r);}
+{priv_->type_name_not_regex_ = r;}
 
 /// Getter for the "type_name_not_regex" property of the type
 /// suppression specification.