* [Ada] Propagate SLOC in iteration over array
@ 2017-12-05 11:58 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2017-12-05 11:58 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
Expand_Iterator_Loop_Over_Array turns a loop over an array:
for Element of Array loop
into a loop with an explicit iteration variable, but it doesn't propagate the
SLOC of Element onto the new iteration variable. This results in inaccurate
information when precise coverage is requested, as the SLOC of the enclosing
loop statement is propagated instead.
The change fixes this issue by using the SLOC of iteration scheme for the
entire rewrite of the construct, except for the new loop statements which
still inherit the SLOC of the original loop statement.
No functional changes.
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-12-05 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Use the SLOC of the
iteration scheme throughout, except for the new loop statement(s).
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1173 bytes --]
Index: exp_ch5.adb
===================================================================
--- exp_ch5.adb (revision 255410)
+++ exp_ch5.adb (working copy)
@@ -3673,7 +3673,7 @@
Array_Typ : constant Entity_Id := Base_Type (Etype (Array_Node));
Array_Dim : constant Pos := Number_Dimensions (Array_Typ);
Id : constant Entity_Id := Defining_Identifier (I_Spec);
- Loc : constant Source_Ptr := Sloc (N);
+ Loc : constant Source_Ptr := Sloc (Isc);
Stats : constant List_Id := Statements (N);
Core_Loop : Node_Id;
Dim1 : Int;
@@ -3734,7 +3734,7 @@
end if;
Core_Loop :=
- Make_Loop_Statement (Loc,
+ Make_Loop_Statement (Sloc (N),
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
@@ -3771,7 +3771,7 @@
-- end loop;
Core_Loop :=
- Make_Loop_Statement (Loc,
+ Make_Loop_Statement (Sloc (N),
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-05 11:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 11:58 [Ada] Propagate SLOC in iteration over array Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).