From patchwork Fri Oct 25 09:10:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 99545 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 B4F9C3858289 for ; Fri, 25 Oct 2024 09:17:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id BCCC1385780C for ; Fri, 25 Oct 2024 09:11:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCCC1385780C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BCCC1385780C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847530; cv=none; b=s9JIuM2ItVBtHmOfKMa9uyqDYGC297n+KZHjbp04tMp5bMpW+JKLT6GNHOCZoZfCKtLQ8/4c8A1r+/mtK+f6v8U+F+s23awyaFIuS6YZhOzgA3x/vGwYsH5nmJufHWxDszddVTz4b7p8loMuCwnHJE0SpXUZ5+zaQPiB9p53wk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729847530; c=relaxed/simple; bh=sMLdYcJ/I1JBalFKgJu9rQHVOB4rE1N+LYBTOkr0yuw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DcP+liFiPmwVqYD9EvoF4iHpBB/t4caHnTjtz1R2RZ1TsCZYKdt29iwEFmJnnDly0q4z8tMZuv4tPSmNAF+wU9667c/+nc9aI+kYiR9xoeAOn9/17Gy+7Ih+1Ls0NVI+veF42eAhtgCnmTUAiSb51TKUzECCm15PgPP+hrdiUGs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so17079415e9.0 for ; Fri, 25 Oct 2024 02:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1729847514; x=1730452314; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9r7LFGoHX8VwnqJ7BIgM7YTNSRq29cR1hDw1cXVa8uY=; b=cVQiv3rdVYxl+l28p4VYavBISXMKyj4l9BHOkZ/2qWZtUvjaOv5qMkU3DZA0gDoVdU DRp70qaJqI4uJCrXOU9G0UUUuUk3r2kd93d630RUkPAgc3bW6wshVX7BwdiuPVbkNWZh 72TNSj7bZswobenR3X/7wT9nYVEBVCbGaD01hFElqfmyNvxsJtT1q1KeXv0sxxUWRtfV lE0fpFgL4/g385KOJ5u3NO8IUxBchVzQbLpMr9W/ent/15OwJXNOsdJFvAEq5uCM/zjZ thE0LKX7YB6iGISGp8qs+wo/uvQnIbg5GjgnnbI+XtZ+KqG3UaOfwdVCXWCfr/72ozPv L82Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729847514; x=1730452314; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9r7LFGoHX8VwnqJ7BIgM7YTNSRq29cR1hDw1cXVa8uY=; b=nPc/s7G+YyDQJPO+imGL4G/IRXy7yNhDQAF8KOoJselwQFgZeSNjjHsC1BVDtCYR+U jd9D/H//so+pQ917pptP0dni6iMHQuD/V9tnWZMQbXdi9tSA3quhMLWYrFR//2vc7Kss 2N+spDMZfFIHEiKtoRN+o4D/+a9W7FZoWgeKDLQXCGnXlHinJB+4/+nrGC4bgF2LOXAn uOMa4ImvmrY38kJa3q/ozeTL0cDRoaOG6Ex1+so2TqtWQrI8dwXFNdvT6Wy42pjBEnjV qFV81qP/GVGtJs1uCzJ3FNZlnD4bSralfP/uFnhrOEQyF9VcVGLVl7JGhw50yS/hvbds PbvQ== X-Gm-Message-State: AOJu0YyYbI3poAbvNCkRxv1UU5/HRtp/o8N7v3Km8a6IgyL2gaf2dvk8 nU5+vVpLBi6t6VrpUDWsQgNYua9eYeqFLAem0wL1fSybWXKXeTTWYmGe3fp+XM8Iap0cTNjxx8w = X-Google-Smtp-Source: AGHT+IFFzjLEQaGIPHGjbpJ/FN9trT8OJsPGDqHrqR/hbFeVvX80faubRPPaGkpdERfcXrGG2JT9ow== X-Received: by 2002:a5d:47c6:0:b0:37c:cd1f:1ee9 with SMTP id ffacd0b85a97d-37efcf85690mr6443292f8f.54.1729847514400; Fri, 25 Oct 2024 02:11:54 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:2626:b78c:6271:6c01]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b47aa8sm1013079f8f.51.2024.10.25.02.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 02:11:53 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Tom Tromey Subject: [COMMITTED 30/35] ada: Add 'artificial_p' parameter to build_unc_object_type Date: Fri, 25 Oct 2024 11:10:59 +0200 Message-ID: <20241025091107.485741-30-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241025091107.485741-1-poulhies@adacore.com> References: <20241025091107.485741-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Tom Tromey This adds an 'artificial_p' parameter to build_unc_object_type, so that the artificiality of the type can be propagated to create_type_decl. This will affect the namelessness of the type in a subsequent patch. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Pass artificial_p to build_unc_object_type. * gcc-interface/gigi.h (build_unc_object_type): Update. * gcc-interface/utils.cc (build_unc_object_type) Add artificial_p parameter. (build_unc_object_type_from_ptr): Update. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 2 +- gcc/ada/gcc-interface/gigi.h | 9 ++++++--- gcc/ada/gcc-interface/utils.cc | 13 ++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index aa22c495a16..14b39b336bd 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -2496,7 +2496,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) ? create_concat_name (gnat_name, "XUT") : gnu_entity_name; obj = build_unc_object_type (gnu_template_type, tem, xut_name, - debug_info_p); + artificial_p, debug_info_p); SET_TYPE_UNCONSTRAINED_ARRAY (obj, gnu_type); TYPE_OBJECT_RECORD_TYPE (gnu_type) = obj; diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index f4b302be3e0..00f00d967c7 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -742,10 +742,13 @@ extern tree build_template (tree template_type, tree array_type, tree expr); is an unconstrained array. This consists of a RECORD_TYPE containing a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE. If ARRAY_TYPE is that of an unconstrained array, this is used to represent - an arbitrary unconstrained object. Use NAME as the name of the record. - DEBUG_INFO_P is true if we need to write debug information for the type. */ + an arbitrary unconstrained object. Use NAME as the name of the + record. ARTIFICIAL_P is true if the type was generated by the + compiler, or false if the type came from source. DEBUG_INFO_P is + true if we need to write debug information for the type. */ extern tree build_unc_object_type (tree template_type, tree object_type, - tree name, bool debug_info_p); + tree name, bool artificial_p, + bool debug_info_p); /* Same as build_unc_object_type, but taking a thin or fat pointer type instead of the template type. */ diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 951d3848d09..9e2715a8d81 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -4465,12 +4465,14 @@ build_vector_type_for_array (tree array_type, tree attribute) is an unconstrained array. This consists of a RECORD_TYPE containing a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an ARRAY_TYPE. If ARRAY_TYPE is that of an unconstrained array, this is used to represent - an arbitrary unconstrained object. Use NAME as the name of the record. - DEBUG_INFO_P is true if we need to write debug information for the type. */ + an arbitrary unconstrained object. Use NAME as the name of the + record. ARTIFICIAL_P is true if the type was generated by the + compiler, or false if the type came from source. DEBUG_INFO_P is + true if we need to write debug information for the type. */ tree build_unc_object_type (tree template_type, tree object_type, tree name, - bool debug_info_p) + bool artificial_p, bool debug_info_p) { tree type = make_node (RECORD_TYPE); tree template_field @@ -4487,7 +4489,7 @@ build_unc_object_type (tree template_type, tree object_type, tree name, /* Declare it now since it will never be declared otherwise. This is necessary to ensure that its subtrees are properly marked. */ - create_type_decl (name, type, true, debug_info_p, Empty); + create_type_decl (name, type, artificial_p, debug_info_p, Empty); return type; } @@ -4508,7 +4510,8 @@ build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type, : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type)))); return - build_unc_object_type (template_type, object_type, name, debug_info_p); + build_unc_object_type (template_type, object_type, name, true, + debug_info_p); } /* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE.