On 07/18/2018 02:40 PM, Jason Merrill wrote:
> On Wed, Jul 18, 2018 at 7:03 PM, Martin Liška <mli...@suse.cz> wrote:
>> On 07/18/2018 03:45 AM, Jason Merrill wrote:
>>> On Mon, Jul 16, 2018 at 5:23 PM, Martin Liška <mli...@suse.cz> wrote:
>>>> For purpose of --coverage I would like to distinguish lambda functions
>>>> among DECL_ARTIFICIAL functions.
>>>
>>> I'm curious, why?
>>
>> It's important for GCOV to report coverage for functions that are
>> really present in a source file. Lambdas are such functions.
>> On the other hand functions like 
>> _Z41__static_initialization_and_destruction_*
>> or some implicit constructors (Centering<3>::Centering(Centering<3> const&))
>> should not be reported. It confuses a user. Note that both have a valid
>> location and one can't distinguish them.
> 
> Those other functions may have *a* location, but only
> DECL_SOURCE_LOCATION; could we distinguish on that basis?
> 
> Jason
> 

I don't know how to distinguish them. Consider:

 <function_decl 0x7fffe82f7200 __dt_base 
    type <method_type 0x7fffe82f9000
        type <void_type 0x7ffff67c0f18 void type_6 VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 
0x7ffff67c0f18
            pointer_to_this <pointer_type 0x7ffff67c8000> reference_to_this 
<reference_type 0x7fffefb642a0>>
        QI
        size <integer_cst 0x7ffff67a2f60 constant 8>
        unit-size <integer_cst 0x7ffff67a2f78 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 
0x7fffe82f62a0 method basetype <record_type 0x7fffe829abd0 BinaryNode>
        arg-types <tree_list 0x7fffeba3ffa0 value <pointer_type 0x7fffe82af000>
            chain <tree_list 0x7ffff67b6898 value <void_type 0x7ffff67c0f18 
void>>>
        throws <tree_list 0x7ffff68f4050
            purpose <integer_cst 0x7ffff67c31f8 constant 1>>
        pointer_to_this <pointer_type 0x7fffe8344000>>
    nothrow public static weak autoinline decl_3 decl_5 QI tramp3d-v4.cpp:867:7 
align:16 warn_if_not_align:0 context <record_type 0x7fffe829abd0 BinaryNode> 
initial <block 0x7fffe832eea0> abstract_origin <function_decl 0x7fffe82f7000 
__dt >
    result <result_decl 0x7fffe8330f78 D.471838 type <void_type 0x7ffff67c0f18 
void>
        ignored VOID tramp3d-v4.cpp:867:7
        align:8 warn_if_not_align:0 context <function_decl 0x7fffe82f7200 
__dt_base >>
    full-name "BinaryNode<OpLT, Field<UniformRectilinearMesh<MeshTraits<3, 
double, UniformRectilinearTag, CartesianTag, 3> >, double, BrickView>, 
Scalar<double> >::~BinaryNode() noexcept"
    pending-inline-info 0x7fffe8341510
    arguments <parm_decl 0x7fffe82f5b00 this
        type <pointer_type 0x7fffe82af150 type <record_type 0x7fffe829abd0 
BinaryNode>
            readonly unsigned DI
            size <integer_cst 0x7ffff67a2e70 constant 64>
            unit-size <integer_cst 0x7ffff67a2e88 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 
0x7fffe82af150>
        readonly unsigned read DI tramp3d-v4.cpp:34712:13 size <integer_cst 
0x7ffff67a2e70 64> unit-size <integer_cst 0x7ffff67a2e88 8>
        align:64 warn_if_not_align:0 context <function_decl 0x7fffe82f7200 
__dt_base > abstract_origin <parm_decl 0x7fffe82f5900 this> arg-type 
<pointer_type 0x7fffe82af150>>
    struct-function 0x7fffe833e580 chain <function_decl 0x7fffe82f7100 
__dt_comp >>

it's DECL_SOURCE_LOCATION is:
$2 = 200862249

and expand_location (DECL_SOURCE_LOCATION (current_function_decl)) is:
(gdb) p xloc
$1 = {
  file = 0x2a58df0 "tramp3d-v4.cpp", 
  line = 867, 
  column = 7, 
  data = 0x0, 
  sysp = false
}

Martin

Reply via email to