Add missing assignment operators
authorDodji Seketeli <dodji@redhat.com>
Wed, 27 Mar 2019 14:24:21 +0000 (15:24 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 27 Mar 2019 14:24:21 +0000 (15:24 +0100)
This was detected by compiling with GCC 9.0.1

* include/abg-interned-str.h (interned_string::operator=): Define
assignment operator.
* include/abg-ir.h
({location, enum_type_decl::enumerator}::operator=): Declare
assignment operator.
* src/abg-ir.cc (enum_type_decl::enumerator::operator=): Define
assignment operator.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-interned-str.h
include/abg-ir.h
src/abg-ir.cc

index ae85ba0..6f40b36 100644 (file)
@@ -82,6 +82,16 @@ public:
   interned_string(const interned_string& o)
   {raw_ = o.raw_;}
 
+  /// Assignment operator.
+  ///
+  /// @param o the other instance to assign to the current one.
+  interned_string&
+  operator=(const interned_string& o)
+  {
+    raw_ = o.raw_;
+    return *this;
+  }
+
   /// Test if the current instance of @ref interned_string is empty.
   ///
   /// @return true iff the currentisntance of @ref interned_string is
index be53b8d..35791d0 100644 (file)
@@ -234,6 +234,17 @@ public:
       loc_manager_(l.loc_manager_)
   {}
 
+  /// Assignment operator of the location.
+  ///
+  /// @param l the location to assign to the current one.
+  location&
+  operator=(const location& l)
+  {
+    value_ = l.value_;
+    loc_manager_ = l.loc_manager_;
+    return *this;
+  }
+
   /// Default constructor for the @ref location type.
   location()
     : value_(), loc_manager_()
@@ -2338,6 +2349,9 @@ public:
 
   enumerator(const enumerator&);
 
+  enumerator&
+  operator=(const enumerator&);
+
   bool
   operator==(const enumerator& other) const;
 
index 0dd180c..434bfac 100644 (file)
@@ -13907,6 +13907,18 @@ enum_type_decl::enumerator::enumerator(const enumerator& other)
                   other.get_enum_type()))
 {}
 
+/// Assignment operator of the @ref enum_type_decl::enumerator type.
+///
+/// @param o
+enum_type_decl::enumerator&
+enum_type_decl::enumerator::operator=(const enumerator& o)
+{
+  priv_->env_ = o.get_environment();
+  priv_->name_ = o.get_name();
+  priv_->value_ = o.get_value();
+  priv_->enum_type_ = o.get_enum_type();
+  return *this;
+}
 /// Equality operator
 ///
 /// @param other the enumerator to compare to the current instance of