From 6ba168688e557e51b9b3f58029337a69e898b2b4 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Thu, 8 Feb 2024 17:30:38 +0100 Subject: [PATCH] ir: Introduce a missing IR kind for subrange types Array subranges were introduced to support the Ada language. In doing so, I forgot to define an enum type_or_decl_kind enumerator for the array_type_def::subrange_type IR node. This patch fixes that. * include/abg-ir.h (type_or_decl_kind::SUBRANGE_TYPE): Add a new enumerator to enum type_or_decl_kind::type_or_decl_kind. * src/abg-ir.cc (array_type_def::subrange_type::subrange_type): Use the new type_or_decl_kind::SUBRANGE_TYPE to flag the IR node representing array_type_def::subrange_type. Signed-off-by: Dodji Seketeli --- include/abg-ir.h | 23 ++++++++++++----------- src/abg-ir.cc | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/abg-ir.h b/include/abg-ir.h index a500762a..964d1397 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -1385,17 +1385,18 @@ protected: ABSTRACT_TYPE_BASE = 1 << 9, ABSTRACT_SCOPE_TYPE_DECL = 1 << 10, BASIC_TYPE = 1 << 11, - QUALIFIED_TYPE = 1 << 12, - POINTER_TYPE = 1 << 13, - REFERENCE_TYPE = 1 << 14, - POINTER_TO_MEMBER_TYPE = 1 << 15, - ARRAY_TYPE = 1 << 16, - ENUM_TYPE = 1 << 17, - TYPEDEF_TYPE = 1 << 18, - CLASS_TYPE = 1 << 19, - UNION_TYPE = 1 << 20, - FUNCTION_TYPE = 1 << 21, - METHOD_TYPE = 1 << 22, + SUBRANGE_TYPE = 1 << 12, + QUALIFIED_TYPE = 1 << 13, + POINTER_TYPE = 1 << 14, + REFERENCE_TYPE = 1 << 15, + POINTER_TO_MEMBER_TYPE = 1 << 16, + ARRAY_TYPE = 1 << 17, + ENUM_TYPE = 1 << 18, + TYPEDEF_TYPE = 1 << 19, + CLASS_TYPE = 1 << 20, + UNION_TYPE = 1 << 21, + FUNCTION_TYPE = 1 << 22, + METHOD_TYPE = 1 << 23, }; // end enum type_or_decl_kind enum type_or_decl_kind diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 58e19c5b..f4d9174f 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -18700,7 +18700,7 @@ array_type_def::subrange_type::subrange_type(const environment& env, const type_base_sptr& utype, const location& loc, translation_unit::language l) - : type_or_decl_base(env, ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), + : type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), type_base(env, upper_bound.get_unsigned_value() - lower_bound.get_unsigned_value(), @@ -18731,7 +18731,7 @@ array_type_def::subrange_type::subrange_type(const environment& env, bound_value upper_bound, const location& loc, translation_unit::language l) - : type_or_decl_base(env, ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), + : type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), type_base(env, upper_bound.get_unsigned_value() - lower_bound.get_unsigned_value(), 0), @@ -18758,7 +18758,7 @@ array_type_def::subrange_type::subrange_type(const environment& env, bound_value upper_bound, const location& loc, translation_unit::language l) - : type_or_decl_base(env, ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), + : type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE), type_base(env, upper_bound.get_unsigned_value(), 0), decl_base(env, name, loc, ""), priv_(new priv(upper_bound, l))