[cfe-dev] Line numbers in debug info for range based for

Justin Bogner mail at justinbogner.com
Fri May 2 15:17:48 PDT 2014


David Blaikie <dblaikie at gmail.com> writes:
>> That commit message is specifically about functions, so it's not clear
>> if the change to artificial variables was intentional.
>>
>> Should these variables have line information? On the one hand, they're
>> artificial, but on the other, they do have a pretty obvious source
>> location they correspond to.
>>
>> Thoughts?
>
> Off-hand thought: do you have a debug info consumer that would benefit
> from this information? (if so, I'd be curious to hear what the
> consumer is/how it's using this information)

Not really. I only noticed this because it exposed a bug in llvm-cov,
and I wasn't sure if it was intentional.

> And the usual retort: GCC does the same thing:
>
> 0x0000008c:         DW_TAG_variable [5]
>                       DW_AT_name [DW_FORM_strp] (
> .debug_str[0x00000019] = "__for_range")
>                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d1 => {0x000000d1})
>                       DW_AT_artificial [DW_FORM_flag_present]   (true)
>                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 58 )
>
> 0x00000098:         DW_TAG_variable [5]
>                       DW_AT_name [DW_FORM_strp] (
> .debug_str[0x00000025] = "__for_begin")
>                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d7 => {0x000000d7})
>                       DW_AT_artificial [DW_FORM_flag_present]   (true)
>                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 60 )
>
> 0x000000a4:         DW_TAG_variable [5]
>                       DW_AT_name [DW_FORM_strp] (
> .debug_str[0x00000031] = "__for_end")
>                       DW_AT_type [DW_FORM_ref4] (cu + 0x00d7 => {0x000000d7})
>                       DW_AT_artificial [DW_FORM_flag_present]   (true)
>                       DW_AT_location [DW_FORM_exprloc]  (<0x2> 91 50 )

Good enough for me. Thanks!



More information about the cfe-dev mailing list