]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tweak discriminant source locations
authorRonan Desplanques <desplanques@adacore.com>
Wed, 3 Jan 2024 11:09:03 +0000 (12:09 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 6 May 2024 09:11:31 +0000 (11:11 +0200)
This patch changes the source location information for the default
expressions of discrimants to better represent the fact that they're
evaluated at the point of object declaration, in the cases where
a Build_Default_Subtype optimization is performed. This fixes a
regression with CodePeer diagnostics introduced by a recent change
around Build_Default_Subtype optimizations.

gcc/ada/

* sem_util.adb (Build_Default_Subtype): Tweak source location
information.

gcc/ada/sem_util.adb

index c47904f168c8e494ec8e140757320e6946b47ae3..18c9de05cf9c963531958bf5ba5d064eabe4bff4 100644 (file)
@@ -1780,7 +1780,8 @@ package body Sem_Util is
       begin
          while Present (Disc) loop
             Append_To (Constraints,
-              New_Copy_Tree (Discriminant_Default_Value (Disc)));
+                       New_Copy_Tree
+                         (Discriminant_Default_Value (Disc), New_Sloc => Loc));
             Next_Discriminant (Disc);
          end loop;