From patchwork Wed Jun 10 11:59:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39556 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 7F0EC3898509; Wed, 10 Jun 2020 12:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F0EC3898509 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790413; bh=23iEIPcotkpB4ELsvqaVuHbbf6lf2uZyjiDlVALpqWA=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Rf6KwO1yFgCPNW/Tqpd6W0zDJip/3/D66CIftj0G67T6wfkxXzjZGtUtW4nesymOs n1hc8lZRuJQe/4smu/GROAJVB8IA8E7OqOYRuriTmItGtw0tl1BhzQkgHQ1Q/Erufn MHHp3FcK2j6PKFbYs/WbrS8VUYKLFu5VhliUlCdE= 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 EC476388E803 for ; Wed, 10 Jun 2020 12:00:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC476388E803 Received: by mail-qt1-x84a.google.com with SMTP id o11so1628980qtm.7 for ; Wed, 10 Jun 2020 05:00:04 -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=23iEIPcotkpB4ELsvqaVuHbbf6lf2uZyjiDlVALpqWA=; b=Bv8sAGhD7LkpjKLs6VeQ2MksVG5nTrURA1BipMh4YHTPKeFfgyNnmyUVpIT+EHdPv9 5J4zo63K2rJcMmswYbDxp+OWXjKQ2G4RFGBSV8jcvPvJYbeC2B4FUzfs2+fZOzG4m4HY BdzrXssCDAdhJl6rmjoYu/sUCEStVCW932noFb1rToq2t2SzNn9/nJlUwhw1Plvr6Mk3 iES0Xax91Ftrhx00bxinMphpi3k28+Ga6Ps3sSXXJbyepUDn+6ybQgwDnqRQ3qqkcefW 5cssrH/hsMU3qah4OwVL6O4bGEzoXZZNSKl7POrWzAanh4AtoNhAADe60HMejeYyax+C Y8ag== X-Gm-Message-State: AOAM531Na427i9aQOm2B/8tbNpocy0tmYL6UhZx+tr+iCsZ0GIu5KncU 2rJdZ2DF+bsHOMX4f6X3+rMJv9BlRwtJMR/I2p43Yn6BY4FK1Okqc7fhJTtCjjQK6KN9uVUTJBn 2uKmpBCws3IWSX7kIZD2ku3V+gbOxP3juszqvX6IQHdGL4g18VAVjN5wK/aFKQITHuxezcsA= X-Google-Smtp-Source: ABdhPJzIQtdGG3iSODilgzmEldnf/LUJDWOjvZXXVwzdafx2Y2uhXINQjeFwuhHUyJr1ExpF5M5+AQNQW48s4g== X-Received: by 2002:a05:6214:1447:: with SMTP id b7mr2799747qvy.83.1591790404375; Wed, 10 Jun 2020 05:00:04 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:39 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-11-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 10/11] Add declaration-only enums to XML reader/writer. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.4 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" Serialisation seems OK. Deserialisation quite likely needs declaration/definition resolution as there is logic for this for class types. Signed-off-by: Giuliano Procida Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 4 ++++ src/abg-writer.cc | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index eb74659f..62eda332 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -4161,6 +4161,9 @@ build_enum_type_decl(read_context& ctxt, location loc; read_location(ctxt, node, loc); + bool is_decl_only = false; + read_is_declaration_only(node, is_decl_only); + bool is_anonymous = false; read_is_anonymous(node, is_anonymous); @@ -4221,6 +4224,7 @@ build_enum_type_decl(read_context& ctxt, enums, linkage_name)); t->set_is_anonymous(is_anonymous); t->set_is_artificial(is_artificial); + t->set_is_declaration_only(is_decl_only); // TODO: more to do here! if (ctxt.push_and_key_type_decl(t, id, add_to_current_scope)) { ctxt.map_xml_node_to_decl(node, t); diff --git a/src/abg-writer.cc b/src/abg-writer.cc index bafa3024..38320867 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -840,6 +840,8 @@ static bool write_elf_symbol_reference(const elf_symbol&, ostream&); static bool write_elf_symbol_reference(const elf_symbol_sptr, ostream&); static void write_class_or_union_is_declaration_only(const class_or_union_sptr&, ostream&); +static void write_enum_is_declaration_only(const enum_type_decl_sptr&, + ostream&); static void write_is_struct(const class_decl_sptr&, ostream&); static void write_is_anonymous(const decl_base_sptr&, ostream&); static void write_naming_typedef(const class_decl_sptr&, write_context&); @@ -1754,6 +1756,20 @@ write_class_or_union_is_declaration_only(const class_or_union_sptr& t, o << " is-declaration-only='yes'"; } +/// Serialize the attribute "is-declaration-only", if the enum has its +/// is_declaration_only property set. +/// +/// @param t the pointer to instance of @ref enum_type_decl to +/// consider. +/// +/// @param o the output stream to serialize to. +static void +write_enum_is_declaration_only(const enum_type_decl_sptr& t, ostream& o) +{ + if (t->get_is_declaration_only()) + o << " is-declaration-only='yes'"; +} + /// Serialize the attribute "is-struct", if the current instance of /// class_decl is a struct. /// @@ -2889,6 +2905,7 @@ write_enum_type_decl(const enum_type_decl_sptr& decl, o << " linkage-name='" << decl->get_linkage_name() << "'"; write_location(decl, ctxt); + write_enum_is_declaration_only(decl, o); string i = id; if (i.empty())