From: Giuliano Procida <gprocida@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com, gprocida@google.com
Subject: [PATCH 04/11] Tidy build_enum_type state variables.
Date: Wed, 10 Jun 2020 12:59:33 +0100 [thread overview]
Message-ID: <20200610115940.26035-5-gprocida@google.com> (raw)
In-Reply-To: <20200610115940.26035-1-gprocida@google.com>
This patch brings the enum code closer to the class/union code, in the
hope that this will ease future code maintenance.
There are no behavioural changes.
* src/abg-dwarf-reader.cc (build_enum_type): Rename local
variable enum_is_anonymous to is_anonymous. Move initilisation
of local variable is_artificial to location corresponding to
that in add_or_update_class_type and add_or_update_union_type
functions.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-dwarf-reader.cc | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 1218f8c7..9b3e6371 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -13284,14 +13284,14 @@ build_enum_type(read_context& ctxt,
location loc;
die_loc_and_name(ctxt, die, loc, name, linkage_name);
- bool enum_is_anonymous = false;
+ bool is_anonymous = false;
// If the enum is anonymous, let's give it a name.
if (name.empty())
{
name = get_internal_anonymous_die_prefix_name(die);
ABG_ASSERT(!name.empty());
// But we remember that the type is anonymous.
- enum_is_anonymous = true;
+ is_anonymous = true;
if (size_t s = scope->get_num_anonymous_member_enums())
name = build_internal_anonymous_die_name(name, s);
@@ -13303,7 +13303,7 @@ build_enum_type(read_context& ctxt,
// representation (name) and location can be later detected as being
// for the same type.
- if (!enum_is_anonymous)
+ if (!is_anonymous)
{
if (use_odr)
{
@@ -13336,6 +13336,7 @@ build_enum_type(read_context& ctxt,
uint64_t size = 0;
if (die_unsigned_constant_attribute(die, DW_AT_byte_size, size))
size *= 8;
+ bool is_artificial = die_is_artificial(die);
// for now we consider that underlying types of enums are all anonymous
bool enum_underlying_type_is_anonymous= true;
@@ -13368,8 +13369,6 @@ build_enum_type(read_context& ctxt,
while (dwarf_siblingof(&child, &child) == 0);
}
- bool is_artificial = die_is_artificial(die);
-
// DWARF up to version 4 (at least) doesn't seem to carry the
// underlying type, so let's create an artificial one here, which
// sole purpose is to be passed to the constructor of the
@@ -13385,7 +13384,7 @@ build_enum_type(read_context& ctxt,
t = dynamic_pointer_cast<type_decl>(d);
ABG_ASSERT(t);
result.reset(new enum_type_decl(name, loc, t, enms, linkage_name));
- result->set_is_anonymous(enum_is_anonymous);
+ result->set_is_anonymous(is_anonymous);
result->set_is_artificial(is_artificial);
ctxt.associate_die_to_type(die, result, where_offset);
return result;
--
2.27.0.278.ge193c7cf3a9-goog
next prev parent reply other threads:[~2020-06-10 11:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 11:59 [PATCH 00/11] Add incomplete enum support Giuliano Procida
2020-06-10 11:59 ` [PATCH 01/11] Missing initialisation of source local variable Giuliano Procida
2020-06-10 11:59 ` [PATCH 02/11] Improve code comments and whitespace Giuliano Procida
2020-06-29 8:26 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 03/11] Refactor d.context() as ctxt in report(enum_diff) Giuliano Procida
2020-06-29 8:54 ` Dodji Seketeli
2020-06-10 11:59 ` Giuliano Procida [this message]
2020-06-29 9:08 ` [PATCH 04/11] Tidy build_enum_type state variables Dodji Seketeli
2020-06-10 11:59 ` [PATCH 05/11] Rename declaration-definition change category Giuliano Procida
2020-06-29 16:17 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 06/11] Support incomplete enums in core and diff code Giuliano Procida
2020-07-06 11:14 ` Dodji Seketeli
[not found] ` <CAGvU0HkuOc74mfL9yLttK4Riwkrj9tmtc3VXxdHAsaCbn2153A@mail.gmail.com>
2020-07-08 9:22 ` Dodji Seketeli
2020-07-08 10:39 ` Giuliano Procida
2020-07-08 15:30 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 07/11] Add invariant to enum_type_decl::set_is_declaration_only Giuliano Procida
2020-07-06 11:15 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 08/11] Support declaration-only enums in DWARF reader Giuliano Procida
2020-07-06 11:22 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 09/11] Support constructing opaque types for enums Giuliano Procida
2020-07-06 11:23 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 10/11] Add declaration-only enums to XML reader/writer Giuliano Procida
2020-07-02 13:55 ` Dodji Seketeli
2020-07-02 15:09 ` Giuliano Procida
2020-07-06 11:05 ` Dodji Seketeli
2020-07-06 11:31 ` Dodji Seketeli
2020-07-07 8:31 ` Giuliano Procida
2020-07-07 14:57 ` Dodji Seketeli
2020-06-10 11:59 ` [PATCH 11/11] Add tests for declaration-only enums Giuliano Procida
2020-07-06 11:26 ` Dodji Seketeli
2020-07-01 13:36 ` [PATCH 00/11] Add incomplete enum support Dodji Seketeli
2020-07-01 15:18 ` Giuliano Procida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200610115940.26035-5-gprocida@google.com \
--to=gprocida@google.com \
--cc=dodji@seketeli.org \
--cc=kernel-team@android.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).