public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Set function_start_locus in gigi
@ 2014-05-18 21:12 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2014-05-18 21:12 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

gimple_expand_cfg contains these lines:

      /* Eventually, all FEs should explicitly set function_start_locus.  */
      if (cfun->function_start_locus == UNKNOWN_LOCATION)
       set_curr_insn_source_location
         (DECL_SOURCE_LOCATION (current_function_decl));
      else
       set_curr_insn_source_location (cfun->function_start_locus);

so it's time to do exactly that.

Tested on x86_64-suse-linux, applied on the mainline.


2014-05-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Rework comment and
	set function_start_locus.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1400 bytes --]

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 210587)
+++ gcc-interface/trans.c	(working copy)
@@ -3574,6 +3574,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
   /* The entry in the CI_CO_LIST that represents a function return, if any.  */
   tree gnu_return_var_elmt = NULL_TREE;
   tree gnu_result;
+  location_t locus;
   struct language_function *gnu_subprog_language;
   vec<parm_attr, va_gc> *cache;
 
@@ -3610,14 +3611,15 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
       relayout_decl (gnu_result_decl);
     }
 
-  /* Set the line number in the decl to correspond to that of the body so that
-     the line number notes are written correctly.  */
-  Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl));
+  /* Set the line number in the decl to correspond to that of the body.  */
+  Sloc_to_locus (Sloc (gnat_node), &locus);
+  DECL_SOURCE_LOCATION (gnu_subprog_decl) = locus;
 
   /* Initialize the information structure for the function.  */
   allocate_struct_function (gnu_subprog_decl, false);
   gnu_subprog_language = ggc_cleared_alloc<language_function> ();
   DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language = gnu_subprog_language;
+  DECL_STRUCT_FUNCTION (gnu_subprog_decl)->function_start_locus = locus;
   set_cfun (NULL);
 
   begin_subprog_body (gnu_subprog_decl);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-18 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-18 21:12 [Ada] Set function_start_locus in gigi Eric Botcazou

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).