]> sourceware.org Git - libabigail.git/commitdiff
ir: Tighten the test for anonymous data member
authorDodji Seketeli <dodji@redhat.com>
Fri, 25 Jun 2021 10:00:26 +0000 (12:00 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 11 Aug 2021 15:37:02 +0000 (17:37 +0200)
In is_anonymous_data_member(), we only test that the name of the data
member is empty; we forget to test that decl_base::get_is_anonymous()
is true.  This might make us wrongly think that a data member is
anonymous in cases like in the equals() function for var_decl, where
we temporarily set the name of the compared var_decl to "" before
invoking the decl_base::operator==.  We do this to perform the
comparison by not taking into account the name of the variable.

This hasn't yet happened on the binaries of the regression test suite,
but it's definitely wrong so I am fixing it here.

* src/abg-ir.cc: (is_anonymous_data_member): Consider
decl_base::get_is_anonymous as well.

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

index 39540582b32d2ce7724868031771bd315c9d785f..8e00eabfaa84d3feec5b1685e7208555f42f853d 100644 (file)
@@ -5474,6 +5474,7 @@ bool
 is_anonymous_data_member(const var_decl& d)
 {
   return (is_data_member(d)
+         && d.get_is_anonymous()
          && d.get_name().empty()
          && is_class_or_union_type(d.get_type()));
 }
This page took 0.056555 seconds and 5 git commands to generate.