From f0f5233903076b7b66eb34ec4e4b4863e0ae83a2 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Oct 10 2016 10:57:25 +0000 Subject: Cleanup functions to detect infinite comparison of class_decl While looking around, I found some things in need of a cleanup. This patch addresses those. * src/abg-ir.cc (class_decl::priv::unmark_as_being_compared): In the overload that takes a pointer to class_decl, re-use the overload that takes a reference. (class_decl::priv::comparison_started): Do not crash if the klass pointer is nil. (equals): In the overload for class_decl&, undef the RESULT macro when it's not used anymore. Signed-off-by: Dodji Seketeli --- diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 4fec018..11a632b 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -12302,9 +12302,8 @@ struct class_decl::priv void unmark_as_being_compared(const class_decl* klass) const { - const environment* env = klass->get_environment(); - assert(env); - env->priv_->classes_being_compared_.erase(klass->get_qualified_name()); + if (klass) + return unmark_as_being_compared(*klass); } /// Test if a given instance of class_decl is being currently @@ -12330,7 +12329,11 @@ struct class_decl::priv /// @return true if @p klass is being compared, false otherwise. bool comparison_started(const class_decl* klass) const - {return comparison_started(*klass);} + { + if (klass) + return comparison_started(*klass); + return false; + } };// end struct class_decl::priv /// A Constructor for instances of \ref class_decl @@ -13814,6 +13817,7 @@ equals(const class_decl& l, const class_decl& r, change_kind* k) } RETURN(result); +#undef RETURN } /// Comparison operator for @ref class_decl.