[applied] ir: Improve the checks done by 'abidw --debug-tc'

Message ID 87mskkh5a7.fsf@redhat.com
State New
Headers
Series [applied] ir: Improve the checks done by 'abidw --debug-tc' |

Commit Message

Dodji Seketeli Sept. 6, 2024, 8:54 p.m. UTC
  Hello,

The abidw --debug-tc option (enabled by the
--enable-debug-type-canonicalization configure option) performs every
type comparison twice; once structurally and once canonically.

This patch improves that checking mode by disabling comparison result
caching.  It makes things slower but it makes the checking more
reliable.

	* src/abg-ir.cc (compare_types_during_canonicalization): Disable
	type comparison result caching during type canonicalization
	debugging.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-ir.cc | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 9348d3c9..bc4eb2b3 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -15214,10 +15214,12 @@  compare_types_during_canonicalization(const type_base& canonical_type,
   if (env.debug_type_canonicalization_is_on())
     {
       bool canonical_equality = false, structural_equality = false;
+      env.priv_->allow_type_comparison_results_caching(false);
       env.priv_->use_canonical_type_comparison_ = false;
       structural_equality = canonical_type == candidate_type;
       env.priv_->use_canonical_type_comparison_ = true;
       canonical_equality = canonical_type == candidate_type;
+      env.priv_->allow_type_comparison_results_caching(true);
       if (canonical_equality != structural_equality)
 	{
 	  std::cerr << "structural & canonical equality different for type: "