OSDN Git Service

2009-04-29 Eric Botcazou <ebotcazou@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Apr 2009 12:49:34 +0000 (12:49 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Apr 2009 12:49:34 +0000 (12:49 +0000)
* exp_ch4.adb (Expand_N_Conditional_Expression): Set the SLOC of an
existing parent If statement on the newly created one.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146957 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb

index ba2afc9..86bb900 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Conditional_Expression): Set the SLOC of an
+       existing parent If statement on the newly created one.
+
 2009-04-29  Emmanuel Briot  <briot@adacore.com>
 
        * gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
index 5a7d713..ba0079e 100644 (file)
@@ -3984,6 +3984,14 @@ package body Exp_Ch4 is
                  Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
                  Expression => Relocate_Node (Elsex))));
 
+         --  Preserve the SLOC of a parent If statement, if any
+
+         if Present (Parent (N))
+           and then Nkind (Parent (N)) = N_If_Statement
+         then
+            Set_Sloc (New_If, Sloc (Parent (N)));
+         end if;
+
          Set_Assignment_OK (Name (First (Then_Statements (New_If))));
          Set_Assignment_OK (Name (First (Else_Statements (New_If))));