From patchwork Wed Jun 10 11:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39550 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95B8D386EC42; Wed, 10 Jun 2020 11:59:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95B8D386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790395; bh=lXwUFGPaXpBQBeI2pUx9W9tUgbV96C8jJPG5xtHdLZY=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wv8p38H9PXhjy3f1kZhFpXx/0R5rw575PnTBPZN+irjx4jIQZh7VTgqOgdKDLluGv jhrAsObZ0k3JkUvr8cRRFthjsH4pxukg39EFJpoA23zOwymSrlkj9uzSIYNysI6v/m 13nzJFdhIPoAD4udFfU+CCAneDaxDaMR3DnNo4aM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by sourceware.org (Postfix) with ESMTPS id 4CF383851C11 for ; Wed, 10 Jun 2020 11:59:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4CF383851C11 Received: by mail-qt1-x84a.google.com with SMTP id l19so1610584qtp.12 for ; Wed, 10 Jun 2020 04:59:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lXwUFGPaXpBQBeI2pUx9W9tUgbV96C8jJPG5xtHdLZY=; b=jvu8bQbjdmogeOd/clZpksW3u445wdGdj7YAVtz94Ifqs+eymGgBCIFxvwgrZBFQ4N +dbEB+fN3SfmcZuc2icyiz4orTfkWrb1/zOhJl+SbQpj4K7PynjYPDiE7MZIFpebuDm0 DNxd72N5m6BdHMwkCaZKxX4p80sJVfibEY23RXc2FDvs6zs1f9rcgTQTskL0LcmhGqNx ewgM+H/9LxDgrhiIV6bYqyF4SQ5a56kdo0SIVtnRCmGzUUSUzl82otAEcx5Y5rzQ10J/ joZRynzoXsUQjJMBzmzW4d6pmjgp+aSmSM/M7Y009KooZIpXP9NsXFin5QGj/9NUsj/T RWvQ== X-Gm-Message-State: AOAM533MFarTkfVPWwZOD4UH2PUY1FXmmknyd65EpU0InsqENnJMj7P+ mHmPDEs+RqKmp9obglXJX6y62lIVigQCvVVWI7h1C1tkTVH/lOuDX/vMNGEx1Na8cf7ocNAPCZO BXD84+539kz4pH6cqrkrJ/DoUpgXapDw/aO5C126tfgtoXOwglQ1wDIg6lJGIxQPMrngp3KI= X-Google-Smtp-Source: ABdhPJxyQYbJ5qIUjTZIenwpp4JKitxLLCSy6Hgvo318/AESw2QB+0vNQ95GVOz9K86uuzwqk1ieNkKyH054NQ== X-Received: by 2002:ad4:4d8f:: with SMTP id cv15mr2754407qvb.195.1591790391788; Wed, 10 Jun 2020 04:59:51 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:33 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-5-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 04/11] Tidy build_enum_type state variables. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Giuliano Procida via Libabigail From: Giuliano Procida Reply-To: Giuliano Procida Cc: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" 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 --- 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(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;