[applied] ir: Make IR node visitor aware of non-canonicalized types
Commit Message
Hello,
is_non_canonicalized_type is the function that decides which type
should be canonicalized or not. So, code that expects a type to be
canonicalized should comply with the rule of
is_non_canonicalized_type, aka The Rule. It turns out, the IR node
visitor code fails to comply with The Rule. Fixed thus. Note that
with this commit, the program build/tests/testirwalker now works fine
on itself. Many thanks to Cestmir Kalina who noticed and reported the
issue.
* src/abg-ir.cc (ir_node_visitor::{mark_type_node_as_visited,
type_node_has_been_visited}): Invoke is_non_canonicalized_type to
know if we should expect a type to have a canonical type or not.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch.
---
src/abg-ir.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
@@ -29380,7 +29380,12 @@ ir_node_visitor::mark_type_node_as_visited(type_base *p)
return;
type_base* canonical_type = p->get_naked_canonical_type();
- ABG_ASSERT(canonical_type);
+ if (is_non_canonicalized_type(p))
+ {
+ ABG_ASSERT(!canonical_type);
+ canonical_type = p;
+ }
+ ABG_ASSERT(canonical_type);
size_t canonical_ptr_value = reinterpret_cast<size_t>(canonical_type);
priv_->visited_ir_nodes.insert(canonical_ptr_value);
@@ -29414,6 +29419,11 @@ ir_node_visitor::type_node_has_been_visited(type_base* p) const
return false;
type_base *canonical_type = p->get_naked_canonical_type();
+ if (is_non_canonicalized_type(p))
+ {
+ ABG_ASSERT(!canonical_type);
+ canonical_type = p;
+ }
ABG_ASSERT(canonical_type);
size_t ptr_value = reinterpret_cast<size_t>(canonical_type);