[Ada] Simplify code by reusing Remove on list of primitive operations
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 19 May 2021 12:05:01 +0000 (14:05 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 7 Jul 2021 16:23:18 +0000 (16:23 +0000)
gcc/ada/

* sem_prag.adb (Analyze_Pragma): Simplify processing of pragma
CPP_Constructor.

gcc/ada/sem_prag.adb

index 41e887d..5705aa7 100644 (file)
@@ -14738,7 +14738,6 @@ package body Sem_Prag is
          --    [, [Link_Name     =>] static_string_EXPRESSION ]);
 
          when Pragma_CPP_Constructor => CPP_Constructor : declare
-            Elmt    : Elmt_Id;
             Id      : Entity_Id;
             Def_Id  : Entity_Id;
             Tag_Typ : Entity_Id;
@@ -14805,12 +14804,7 @@ package body Sem_Prag is
                then
                   Tag_Typ := Etype (Def_Id);
 
-                  Elmt := First_Elmt (Primitive_Operations (Tag_Typ));
-                  while Present (Elmt) and then Node (Elmt) /= Def_Id loop
-                     Next_Elmt (Elmt);
-                  end loop;
-
-                  Remove_Elmt (Primitive_Operations (Tag_Typ), Elmt);
+                  Remove (Primitive_Operations (Tag_Typ), Def_Id);
                   Set_Is_Dispatching_Operation (Def_Id, False);
                end if;