[Lldb-commits] [PATCH] D79811: WIP: Reenable creation of artificial methods in AddMethodToCXXRecordType(...)

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 14 05:20:28 PDT 2020


labath added a subscriber: dblaikie.
labath added a comment.

Here's another interesting use of aritificial functions: inherited constructors.

  struct A { A(int); };
  struct B:A { using A::A; };
  B b(2);

The constructor B::B(int) will be marked artificial, but it is also not reconstructible from the debug info because it use explicit default initializers for all members in `B` (if they existed -- this example does not have any).

This example also demonstrates what I believe *is* a bug in the compiler. The inherited constructor will get `DW_AT_name(A)`:

  0x0000003f:   DW_TAG_structure_type
                  DW_AT_calling_convention	(DW_CC_pass_by_value)
                  DW_AT_name	("B")
                  DW_AT_byte_size	(0x01)
                  DW_AT_decl_file	("/home/pavelo/ll/build/opt/<stdin>")
                  DW_AT_decl_line	(1)
  
  0x00000048:     DW_TAG_inheritance
                    DW_AT_type	(0x0000005f "A")
                    DW_AT_data_member_location	(0x00)
  
  0x0000004e:     DW_TAG_subprogram
                    DW_AT_name	("A")
                    DW_AT_declaration	(true)
                    DW_AT_artificial	(true)
                    DW_AT_external	(true)

That doesn't sound correct to me. Gcc emits the name as `B`, which seems to be much better. Looping in @dblaikie for thoughts.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79811/new/

https://reviews.llvm.org/D79811





More information about the lldb-commits mailing list