From patchwork Wed Dec 2 15:42:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1409804 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=UVdtqpgc; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CmNWr2p8Xz9sVl for ; Thu, 3 Dec 2020 02:42:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 773BD395C846; Wed, 2 Dec 2020 15:42:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id BC79E395C402 for ; Wed, 2 Dec 2020 15:42:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC79E395C402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qk1-x731.google.com with SMTP id b144so1561147qkc.13 for ; Wed, 02 Dec 2020 07:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=NeCYJ9cIv9+WwVejuCL0xn/9h6oxfmlzsJvcwktsj7g=; b=UVdtqpgcCdOsxBCJmIFntg0yxDoUvbk654/rBvhot3S+PuJGR7rbQju0tHqjbriNpk uEwKQgzhYpkv60HquF8Ti7lPL9KATf0qrA+roeNxyvATKW0VC0Zzos01iGs6xCtXYqAK R7+TOm18YIe4/K2ZNKTQWF9IiAn5lhjVfJytBxGIxTEIOGHRZUr5nFVexwNjTaBVyeTU Rugnh68lIhus0Qscwd5B9CKcynpfA6A8ZSHmrkJh8hwPvDx6qnlkZGwp4JFebPtnzFcN vWuejgw0d9JjrtFSeSAbXveju6MYlGBImlZ3TA7Ei5PU1GThUImItPCi6/hSjPIM92Uz e0NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=NeCYJ9cIv9+WwVejuCL0xn/9h6oxfmlzsJvcwktsj7g=; b=JChY5E4GDbWjj6ya2v7RlgLG6YYSM6i+F3Nnj1BFGZRcCT50P2lJvK98vOByLmysUp v5UpUCxOkjGo2n5U3vrAR6B32M7R8Ce0RQPLMH1x1pHYuL+DsxbdsuE7Q09Zud3gLKTY cfVses2gQLr/OHkD/n+ezxUASP0BobRfFkll6lZc2TUJioefAZKPci1vyjHf3KZaHZxU Za6zCIiR+FX6bnW36+XBZWa90i5a78+dOZEmTZb28LCHIwFGU0ArhS76GJCt/rbU66MS OeRZK/3+vKWo0n/U0b7TsWm3bBzkgYrTeYRMfmuG2Sn1UjUEmr2lPmc7IMk3FqFqA5BU ONvg== X-Gm-Message-State: AOAM533KIdGwI6pG3b6RY20ruVOQ/SPSvuMq/NSR+KgqHIIoYUUw6xxU Ivlbyrp7jmn+W9b+sAJMLpke+pfY+LU= X-Google-Smtp-Source: ABdhPJzBZI+Gus5LNG/kbYQGusdGw6MBsW1l3k1Xc4vw2MQLfMVIux91ZRMCyjsFXrm6ZTVytJKyGQ== X-Received: by 2002:a37:6f07:: with SMTP id k7mr3098035qkc.476.1606923742935; Wed, 02 Dec 2020 07:42:22 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:fd8c:7733:5cca:4143? ([2620:10d:c091:480::1:9ae]) by smtp.googlemail.com with ESMTPSA id h142sm2109488qke.104.2020.12.02.07.42.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2020 07:42:21 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: Add lang_decl, type_decl API Message-ID: <5b44e279-aa48-700e-ac23-4818dc0c1026@acm.org> Date: Wed, 2 Dec 2020 10:42:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" We need to call the lang_decl and type_decl creators from the module loading machinery. This makes them reachable. gcc/cp/ * cp-tree.h (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Declare. * lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Externalize, reformat. pushing to trunk diff --git i/gcc/cp/cp-tree.h w/gcc/cp/cp-tree.h index ae1147d4589..4eaa10bc7fd 100644 --- i/gcc/cp/cp-tree.h +++ w/gcc/cp/cp-tree.h @@ -6759,6 +6759,8 @@ extern tree unqualified_fn_lookup_error (cp_expr); extern tree make_conv_op_name (tree); extern tree build_lang_decl (enum tree_code, tree, tree); extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree); +extern bool maybe_add_lang_decl_raw (tree, bool decomp_p); +extern bool maybe_add_lang_type_raw (tree); extern void retrofit_lang_decl (tree); extern void fit_decomposition_lang_decl (tree, tree); extern tree copy_decl (tree CXX_MEM_STAT_INFO); diff --git i/gcc/cp/lex.c w/gcc/cp/lex.c index 21e33d69c08..795f5718198 100644 --- i/gcc/cp/lex.c +++ w/gcc/cp/lex.c @@ -680,7 +680,7 @@ build_lang_decl_loc (location_t loc, enum tree_code code, tree name, tree type) /* Maybe add a raw lang_decl to T, a decl. Return true if it needed one. */ -static bool +bool maybe_add_lang_decl_raw (tree t, bool decomp_p) { size_t size; @@ -833,8 +833,7 @@ copy_lang_type (tree node) if (! TYPE_LANG_SPECIFIC (node)) return; - struct lang_type *lt - = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type)); + auto *lt = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type)); memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type))); TYPE_LANG_SPECIFIC (node) = lt; @@ -860,15 +859,15 @@ copy_type (tree type MEM_STAT_DECL) /* Add a raw lang_type to T, a type, should it need one. */ -static bool +bool maybe_add_lang_type_raw (tree t) { if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t))) return false; - TYPE_LANG_SPECIFIC (t) - = (struct lang_type *) (ggc_internal_cleared_alloc - (sizeof (struct lang_type))); + auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc + (sizeof (struct lang_type))); + TYPE_LANG_SPECIFIC (t) = lt; if (GATHER_STATISTICS) {