From f85dd789c2d1f2a1b79182ac3c9c11c46dc97f2f Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 27 Mar 2019 15:24:21 +0100 Subject: [PATCH] Add missing assignment operators 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 --- include/abg-interned-str.h | 10 ++++++++++ include/abg-ir.h | 14 ++++++++++++++ src/abg-ir.cc | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h index ae85ba06..6f40b36f 100644 --- a/include/abg-interned-str.h +++ b/include/abg-interned-str.h @@ -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 diff --git a/include/abg-ir.h b/include/abg-ir.h index be53b8d7..35791d08 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -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; diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 0dd180c5..434bfacd 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -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 -- 2.43.5