From b440715089382938b9729d20f5dcaf646e6372fd Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 12 Sep 2020 12:42:06 +0200 Subject: [PATCH] Minor tweak to line debug info This prevents the SLOC of the expression for a tag from being present in the line debug info every time it is referenced for coverage purposes. gcc/ada/ChangeLog: * gcc-interface/trans.c (gnat_to_gnu) : Clear the SLOC of the expression of a tag. --- gcc/ada/gcc-interface/trans.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index e3d71bca40f..aa4393c24b7 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6476,6 +6476,7 @@ gnat_to_gnu (Node_Id gnat_node) gnu_expr = gnat_to_gnu (Expression (gnat_node)); + /* First deal with erroneous expressions. */ if (TREE_CODE (gnu_expr) == ERROR_MARK) { /* If this is a named number for which we cannot manipulate @@ -6485,6 +6486,11 @@ gnat_to_gnu (Node_Id gnat_node) else if (type_annotate_only) gnu_expr = NULL_TREE; } + + /* Then a special case: we do not want the SLOC of the expression + of the tag to pop up every time it is referenced somewhere. */ + else if (EXPR_P (gnu_expr) && Is_Tag (gnat_temp)) + SET_EXPR_LOCATION (gnu_expr, UNKNOWN_LOCATION); } else gnu_expr = NULL_TREE; -- 2.30.2