From bb8d7063c1117ad3f3538059ca005865a0139437 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Fri, 22 Mar 2024 15:09:33 +0000 Subject: [PATCH] Rename follow_struct_or_union_tag to follow_tag With the new `struct_or_union_tag_typet` the API is entirely consistent with the other `follow_tag` variants. Invoking `follow_struct_or_union_tag(to_struct_or_union_tag_type(t))` just made for awkwardly looking code. --- src/util/namespace.cpp | 5 +++-- src/util/namespace.h | 7 +------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/util/namespace.cpp b/src/util/namespace.cpp index 069c1e71806..d758bb73b83 100644 --- a/src/util/namespace.cpp +++ b/src/util/namespace.cpp @@ -92,8 +92,9 @@ namespace_baset::follow_tag(const c_enum_tag_typet &src) const return to_c_enum_type(symbol.type); } -const struct_union_typet &namespace_baset::follow_struct_or_union_tag( - const struct_or_union_tag_typet &src) const +/// Resolve a `struct_tag_typet` or `union_tag_typet` to the complete version. +const struct_union_typet & +namespace_baset::follow_tag(const struct_or_union_tag_typet &src) const { const symbolt &symbol = lookup(src.get_identifier()); CHECK_RETURN(symbol.is_type); diff --git a/src/util/namespace.h b/src/util/namespace.h index 0b7d05f72a3..090c7625161 100644 --- a/src/util/namespace.h +++ b/src/util/namespace.h @@ -64,15 +64,10 @@ class namespace_baset DEPRECATED(SINCE(2024, 2, 19, "use follow_tag(...) instead")) const typet &follow(const typet &) const; - // These produce union_typet, struct_typet, c_enum_typet or - // the incomplete version. const union_typet &follow_tag(const union_tag_typet &) const; const struct_typet &follow_tag(const struct_tag_typet &) const; const c_enum_typet &follow_tag(const c_enum_tag_typet &) const; - - /// Resolve a `struct_tag_typet` or `union_tag_typet` to the complete version. - const struct_union_typet & - follow_struct_or_union_tag(const struct_or_union_tag_typet &) const; + const struct_union_typet &follow_tag(const struct_or_union_tag_typet &) const; /// Returns the minimal integer n such that there is no symbol (in any of the /// symbol tables) whose name is of the form "An" where A is \p prefix.