public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] A new utility routine for detecting attribute 'Old
@ 2019-09-17  8:06 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-09-17  8:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- 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
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-17  8:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17  8:06 [Ada] A new utility routine for detecting attribute 'Old Pierre-Marie de Rodat

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).