This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: C FE and column numbers


>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

>> However, there is one exception, which is that a function definition
>> is given the location of the opening brace of the function's body.
>> This is pre-existing code; I left it as-is on the theory that it gives
>> a better experience in the debugger.  This means that a function has
>> one location while parsing the "header" and then another once the body
>> is seen.  This is a bit odd (and resulted in the patch to the test
>> suite), but IMO is still clear and maintainable -- so I kept it.

Daniel> As long as the line number for the prologue is associated with the
Daniel> opening brace (which makes some sense), it seems to me that the
Daniel> function name is a better place for the function's location.  As long
Daniel> as it's the copy of the name in the definition, of course!

My reading of cfgexpand.c is that the prologue's location comes from
the function decl's location:

  if (!DECL_BUILT_IN (current_function_decl))
    set_curr_insn_source_location (DECL_SOURCE_LOCATION (current_function_decl));
  set_curr_insn_block (DECL_INITIAL (current_function_decl));
  prologue_locator = curr_insn_locator ();

I haven't tested this theory by modifying the parser.

I suppose it might be possible to take the prologue's location from
the location of the outermost block of the function.  I'll try to look
at this soon.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]