[Ada] Fix attributes Version and Body_Version for concurrent units
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 24 Dec 2020 09:20:13 +0000 (10:20 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 3 May 2021 09:28:24 +0000 (05:28 -0400)
gcc/ada/

* sem_attr.adb (Check_Program_Unit): Fix references to
Concurrent_Kind and Is_Concurrent_Type; avoid repeated calls to
Entity.

gcc/ada/sem_attr.adb

index a9d095d..98b0eca 100644 (file)
@@ -2298,16 +2298,15 @@ package body Sem_Attr is
       begin
          if Is_Entity_Name (P) then
             declare
-               K : constant Entity_Kind := Ekind (Entity (P));
-               T : constant Entity_Id   := Etype (Entity (P));
-
+               E : constant Entity_Id := Entity (P);
             begin
-               if K in Concurrent_Kind
-                     | Entry_Kind
-                     | Generic_Unit_Kind
-                     | Subprogram_Kind
-                     | E_Package
-                 or else (K = E_Variable and then Is_Concurrent_Type (T))
+               if Ekind (E) in E_Protected_Type
+                             | E_Task_Type
+                             | Entry_Kind
+                             | Generic_Unit_Kind
+                             | Subprogram_Kind
+                             | E_Package
+                 or else Is_Single_Concurrent_Object (E)
                then
                   return;
                end if;