[applied] btf-reader: Use abigail::ir::canonicalize_types to canonicalize types

Message ID 87h6x3kvz0.fsf@redhat.com
State New
Headers
Series [applied] btf-reader: Use abigail::ir::canonicalize_types to canonicalize types |

Commit Message

Dodji Seketeli Jan. 7, 2023, 12:51 a.m. UTC
  Hello,

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
  

Patch

diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc
index abab0f66..2c009aee 100644
--- a/src/abg-btf-reader.cc
+++ b/src/abg-btf-reader.cc
@@ -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