]> sourceware.org Git - libabigail.git/commitdiff
get_canonical_type_for: restore environment better
authorGiuliano Procida <gprocida@google.com>
Wed, 17 Jun 2020 16:17:20 +0000 (17:17 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 24 Jun 2020 05:31:17 +0000 (07:31 +0200)
The method type_base::get_canonical_type_for contains some logic which
temporarily changes a couple of control flags in the type's
environment. It then restores these, but not consistently.

This patch ensures the flags are restored unconditionally.

* src/abg-ir.cc (get_canonical_type_for): Ensure the
do_on_the_fly_canonicalization and
decl_only_class_equals_definition flags are restored
unconditionally.

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

index da3716d503e04a55d6a4a440073bc83d7f1e8257..4813035e5935dcb0798483d00c5308b0133bc25e 100644 (file)
@@ -11913,26 +11913,19 @@ type_base::get_canonical_type_for(type_base_sptr t)
          // Compare types by considering that decl-only classes don't
          // equal their definition.
          env->decl_only_class_equals_definition(false);
-         if (types_defined_same_linux_kernel_corpus_public(**it, *t))
-           {
-             result = *it;
-             break;
-           }
-         if (*it == t)
+         bool equal = types_defined_same_linux_kernel_corpus_public(**it, *t)
+                      || *it == t;
+         // Restore the state of the on-the-fly-canonicalization and
+         // the decl-only-class-being-equal-to-a-matching-definition
+         // flags.
+         env->do_on_the_fly_canonicalization(false);
+         env->decl_only_class_equals_definition
+           (saved_decl_only_class_equals_definition);
+         if (equal)
            {
-             // Restore the state of the on-the-fly-canonicalization
-             // and the
-             // decl-only-class-being-equal-to-a-matching-definition
-             // flags, as we are getting out of the loop.
-             env->do_on_the_fly_canonicalization(false);
-             env->decl_only_class_equals_definition
-               (saved_decl_only_class_equals_definition);
              result = *it;
              break;
            }
-         env->do_on_the_fly_canonicalization(false);
-         env->decl_only_class_equals_definition
-           (saved_decl_only_class_equals_definition);
        }
       if (!result)
        {
This page took 0.063582 seconds and 5 git commands to generate.