btf-reader: Use abigail::ir::canonicalize_types to canonicalize types
authorDodji Seketeli <dodji@redhat.com>
Sat, 7 Jan 2023 00:15:28 +0000 (01:15 +0100)
committerDodji Seketeli <dodji@redhat.com>
Sat, 7 Jan 2023 00:15:28 +0000 (01:15 +0100)
In the btf::reader::canonicalize_types function, this patch now uses
the abigail::ir::canonicalize_types() function to canonicalize types,
just like the other front-ends.  The advantage of this function is
that it can perform some sanity checking for type canonicalization
that might be useful for later debugging purposes.

* src/abg-btf-reader.cc (btf::reader::canonicalize_types): Use the
abigail::ir::canonicalize_types function from abg-ir-priv.h
file to canonicalize types.

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

index abab0f6698682d0df0056a493609c5154b47135c..2c009aeeefe30a26e01f563982b6118078d3815c 100644 (file)
@@ -19,6 +19,7 @@
 #include <unordered_map>
 
 #include "abg-elf-helpers.h"
+#include "abg-ir-priv.h"
 
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
@@ -180,12 +181,15 @@ class reader : public elf_based_reader
   {types_to_canonicalize_.push_back(t);}
 
   /// Canonicalize all the types scheduled for canonicalization using
-  /// schedule_type_for_canonocalization().
+  /// abigail::ir::canonicalize_types() which performs some sanity
+  /// checking around type canonicalization if necessary.
   void
   canonicalize_types()
   {
-    for (auto t : types_to_canonicalize_)
-      canonicalize(t);
+    ir::canonicalize_types(types_to_canonicalize_.begin(),
+                          types_to_canonicalize_.end(),
+                          [](const vector<type_base_sptr>::const_iterator& i)
+                          {return *i;});
   }
 
   uint64_t