[6/8,applied] Bug 27236 - Allow updating classes from abixml

Message ID 87lf58c695.fsf@redhat.com
State New
Headers
Series [1/8,applied] ir: Improve the debugging facilities |

Commit Message

Dodji Seketeli Aug. 11, 2021, 4:09 p.m. UTC
  Hello,

Some classes can be defined piece-wise, in some rare cases in the
abixml.  build_class_decl is currently preventing that to happen,
leading to some spurious self comparison errors.

Fixed thus.

	* src/abg-reader.cc (build_class_decl): Keep going when the class
	has already been built.  The rest of the code knows how to add new
	stuff.
	* tests/data/test-abidiff/test-PR18791-report0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
 src/abg-reader.cc                             |   7 +-
 .../test-abidiff/test-PR18791-report0.txt     | 131 +++++++++++++++++-
 2 files changed, 132 insertions(+), 6 deletions(-)
  

Patch

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 63216029..b115304f 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -4535,14 +4535,13 @@  build_class_decl(read_context&		ctxt,
 
   ABG_ASSERT(!id.empty());
 
+  class_decl_sptr previous_definition, previous_declaration;
   if (type_base_sptr t = ctxt.get_type_decl(id))
     {
-      class_decl_sptr result = is_class_type(t);
-      ABG_ASSERT(result);
-      return result;
+      previous_definition  = is_class_type(t);
+      ABG_ASSERT(previous_definition);
     }
 
-  class_decl_sptr previous_definition, previous_declaration;
   const vector<type_base_sptr> *types_ptr = 0;
   if (!is_anonymous && !previous_definition)
     types_ptr = ctxt.get_all_type_decls(id);
diff --git a/tests/data/test-abidiff/test-PR18791-report0.txt b/tests/data/test-abidiff/test-PR18791-report0.txt
index 5de96dc6..6c236f92 100644
--- a/tests/data/test-abidiff/test-PR18791-report0.txt
+++ b/tests/data/test-abidiff/test-PR18791-report0.txt
@@ -1,4 +1,4 @@ 
-Functions changes summary: 1 Removed, 35 Changed, 1 Added functions
+Functions changes summary: 1 Removed, 60 Changed, 1 Added functions
 Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
 
 1 Removed function:
@@ -9,7 +9,7 @@  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
 
   [A] 'method void std::__cxx11::_List_base<sigc::slot_base, std::allocator<sigc::slot_base> >::_M_clear()'
 
-35 functions with some indirect sub-type change:
+60 functions with some indirect sub-type change:
 
   [C] 'method bool sigc::connection::block(bool)' has some indirect sub-type changes:
     implicit parameter 0 of type 'sigc::connection*' has sub-type changes:
@@ -193,6 +193,26 @@  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
     implicit parameter 0 of type 'sigc::internal::signal_impl*' has sub-type changes:
       pointed to type 'struct sigc::internal::signal_impl' changed, as reported earlier
 
+  [C] 'method void sigc::internal::slot_rep::disconnect()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::internal::slot_rep*' has sub-type changes:
+      pointed to type 'struct sigc::internal::slot_rep' changed, as reported earlier
+
+  [C] 'method void sigc::internal::trackable_callback_list::add_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::internal::trackable_callback_list*' has sub-type changes:
+      pointed to type 'struct sigc::internal::trackable_callback_list' changed, as reported earlier
+
+  [C] 'method void sigc::internal::trackable_callback_list::clear()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::internal::trackable_callback_list*' has sub-type changes:
+      pointed to type 'struct sigc::internal::trackable_callback_list' changed, as reported earlier
+
+  [C] 'method void sigc::internal::trackable_callback_list::remove_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::internal::trackable_callback_list*' has sub-type changes:
+      pointed to type 'struct sigc::internal::trackable_callback_list' changed, as reported earlier
+
+  [C] 'method sigc::internal::trackable_callback_list::~trackable_callback_list(int)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::internal::trackable_callback_list*' has sub-type changes:
+      pointed to type 'struct sigc::internal::trackable_callback_list' changed, as reported earlier
+
   [C] 'method void sigc::signal_base::block(bool)' has some indirect sub-type changes:
     implicit parameter 0 of type 'sigc::signal_base*' has sub-type changes:
       in pointed to type 'struct sigc::signal_base':
@@ -281,3 +301,110 @@  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
     implicit parameter 0 of type 'sigc::signal_base*' has sub-type changes:
       pointed to type 'struct sigc::signal_base' changed, as reported earlier
 
+  [C] 'method void sigc::slot_base::add_destroy_notify_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::slot_base*' has sub-type changes:
+      in pointed to type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method bool sigc::slot_base::block(bool)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method void sigc::slot_base::disconnect()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method bool sigc::slot_base::operator bool()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::slot_base*' has sub-type changes:
+      in pointed to type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method sigc::slot_base& sigc::slot_base::operator=(const sigc::slot_base&)' has some indirect sub-type changes:
+    return type changed:
+      referenced type 'class sigc::slot_base' changed, as reported earlier
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+    parameter 1 of type 'const sigc::slot_base&' has sub-type changes:
+      in referenced type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method void sigc::slot_base::remove_destroy_notify_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::slot_base*' has sub-type changes:
+      in pointed to type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method void sigc::slot_base::set_parent(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::slot_base*' has sub-type changes:
+      in pointed to type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method sigc::slot_base::slot_base(sigc::slot_base::rep_type*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+    parameter 1 of type 'sigc::slot_base::rep_type*' has sub-type changes:
+      pointed to type 'typedef sigc::slot_base::rep_type' changed, as reported earlier
+
+  [C] 'method sigc::slot_base::slot_base()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method sigc::slot_base::slot_base(const sigc::slot_base&)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+    parameter 1 of type 'const sigc::slot_base&' has sub-type changes:
+      in referenced type 'const sigc::slot_base':
+        unqualified underlying type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method bool sigc::slot_base::unblock()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method sigc::slot_base::~slot_base(int)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::slot_base*' has sub-type changes:
+      pointed to type 'class sigc::slot_base' changed, as reported earlier
+
+  [C] 'method void sigc::trackable::add_destroy_notify_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::trackable*' has sub-type changes:
+      in pointed to type 'const sigc::trackable':
+        unqualified underlying type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method sigc::internal::trackable_callback_list* sigc::trackable::callback_list()' has some indirect sub-type changes:
+    return type changed:
+      pointed to type 'struct sigc::internal::trackable_callback_list' changed, as reported earlier
+    implicit parameter 0 of type 'const sigc::trackable*' has sub-type changes:
+      in pointed to type 'const sigc::trackable':
+        unqualified underlying type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method void sigc::trackable::notify_callbacks()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::trackable*' has sub-type changes:
+      pointed to type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method sigc::trackable& sigc::trackable::operator=(const sigc::trackable&)' has some indirect sub-type changes:
+    return type changed:
+      referenced type 'struct sigc::trackable' changed, as reported earlier
+    implicit parameter 0 of type 'sigc::trackable*' has sub-type changes:
+      pointed to type 'struct sigc::trackable' changed, as reported earlier
+    parameter 1 of type 'const sigc::trackable&' has sub-type changes:
+      in referenced type 'const sigc::trackable':
+        unqualified underlying type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method void sigc::trackable::remove_destroy_notify_callback(void*)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'const sigc::trackable*' has sub-type changes:
+      in pointed to type 'const sigc::trackable':
+        unqualified underlying type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method sigc::trackable::trackable(const sigc::trackable&)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::trackable*' has sub-type changes:
+      pointed to type 'struct sigc::trackable' changed, as reported earlier
+    parameter 1 of type 'const sigc::trackable&' has sub-type changes:
+      in referenced type 'const sigc::trackable':
+        unqualified underlying type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method sigc::trackable::trackable()' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::trackable*' has sub-type changes:
+      pointed to type 'struct sigc::trackable' changed, as reported earlier
+
+  [C] 'method sigc::trackable::~trackable(int)' has some indirect sub-type changes:
+    implicit parameter 0 of type 'sigc::trackable*' has sub-type changes:
+      pointed to type 'struct sigc::trackable' changed, as reported earlier
+