public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [Ada] A new utility routine for detecting attribute 'Old
Date: Tue, 17 Sep 2019 08:06:00 -0000	[thread overview]
Message-ID: <20190917080633.GA37488@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

Add a utility routine for detecting attribute 'Old. It will be
immediately reused in the GNATprove backend.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-09-17  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_util.ads, sem_util.adb (Is_Attribute_Old): New utility
	routine.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1053 bytes --]

--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -13559,6 +13559,16 @@ package body Sem_Util is
                              Is_Volatile_Full_Access (Etype (Entity (N)))));
    end Is_Atomic_Or_VFA_Object;
 
+   ----------------------
+   -- Is_Attribute_Old --
+   ----------------------
+
+   function Is_Attribute_Old (N : Node_Id) return Boolean is
+   begin
+      return Nkind (N) = N_Attribute_Reference
+        and then Attribute_Name (N) = Name_Old;
+   end Is_Attribute_Old;
+
    -------------------------
    -- Is_Attribute_Result --
    -------------------------

--- gcc/ada/sem_util.ads
+++ gcc/ada/sem_util.ads
@@ -1549,6 +1549,9 @@ package Sem_Util is
    --  Determine whether arbitrary node N denotes a reference to an object
    --  which is either atomic or Volatile_Full_Access.
 
+   function Is_Attribute_Old (N : Node_Id) return Boolean;
+   --  Determine whether node N denotes attribute 'Old
+
    function Is_Attribute_Result (N : Node_Id) return Boolean;
    --  Determine whether node N denotes attribute 'Result
 


                 reply	other threads:[~2019-09-17  8:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190917080633.GA37488@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /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).