[Ada] Clarify code for detecting volatile refinement properties
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 7 Mar 2022 13:07:15 +0000 (14:07 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:02 +0000 (08:42 +0000)
Routine Type_Or_Variable_Has_Enabled_Property handles either types or
objects; replace negation with an explicit positive condition.

Cleanup related to handling of volatile refinement aspects in SPARK;
behaviour is unaffected.

gcc/ada/

* sem_util.adb (Type_Or_Variable_Has_Enabled_Property): Clarify.

gcc/ada/sem_util.adb

index d53c435..6cf3c70 100644 (file)
@@ -12696,10 +12696,10 @@ package body Sem_Util is
             return Type_Or_Variable_Has_Enabled_Property
               (First_Subtype (Etype (Base_Type (Item_Id))));
 
-         --  If not specified explicitly for an object and the type
+         --  If not specified explicitly for an object and its type
          --  is effectively volatile, then take result from the type.
 
-         elsif not Is_Type (Item_Id)
+         elsif Is_Object (Item_Id)
            and then Is_Effectively_Volatile (Etype (Item_Id))
          then
             return Has_Enabled_Property (Etype (Item_Id), Property);