[17/27] dwarf-reader: Fix building of void, void* and variadic parm types
Commit Message
Hello,
This patch adds the IR nodes of void, void* and variadic parm types to
their scope just once. Also, it schedules them for (sorting, hashing
and) canonicalization just like other types.
* src/abg-dwarf-reader.cc (build_ir_node_for_void_type)
(build_ir_node_for_void_pointer_type)
(build_ir_node_for_variadic_parameter_type): Add the type node to
its scope just once. Use
reader::schedule_type_for_late_canonicalization to canonicalize
it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
src/abg-dwarf-reader.cc | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
@@ -17158,9 +17158,12 @@ build_ir_node_for_void_type(reader& rdr)
const environment& env = rdr.env();
type_base_sptr t = env.get_void_type();
- add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
decl_base_sptr type_declaration = get_type_declaration(t);
- canonicalize(t);
+ if (!has_scope(type_declaration))
+ {
+ add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
+ rdr.schedule_type_for_late_canonicalization(t);
+ }
return type_declaration;
}
@@ -17179,11 +17182,13 @@ static type_or_decl_base_sptr
build_ir_node_for_void_pointer_type(reader& rdr)
{
const environment& env = rdr.env();
-
type_base_sptr t = env.get_void_pointer_type();
- add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
decl_base_sptr type_declaration = get_type_declaration(t);
- canonicalize(t);
+ if (!has_scope(type_declaration))
+ {
+ add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
+ rdr.schedule_type_for_late_canonicalization(t);
+ }
return type_declaration;
}
@@ -17197,11 +17202,13 @@ build_ir_node_for_variadic_parameter_type(reader &rdr)
{
const environment& env = rdr.env();
-
type_base_sptr t = env.get_variadic_parameter_type();
- add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
decl_base_sptr type_declaration = get_type_declaration(t);
- canonicalize(t);
+ if (!has_scope(type_declaration))
+ {
+ add_decl_to_scope(is_decl(t), rdr.cur_transl_unit()->get_global_scope());
+ rdr.schedule_type_for_late_canonicalization(t);
+ }
return type_declaration;
}