[Lldb-commits] [PATCH] D126668: LLDB: Fix resolving nested template parameters

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 13 00:08:49 PDT 2022


teemperor added a comment.

> I don't really have the full context here, but I am wondering if we shouldn't somehow take the DW_AT_declaration attribute into account here. It seems like that should give a more definitive answer as to whether we can expect to see a full set of template parameters or not.

I think that is actually a good approach. I think the current patch rejects forward declarations (which is fine as we don't have the required information in DWARF) and empty parameter packs (which is the edge case the original patch fixed).

Example: this is currently rejected even though we have all the required information:

  template<typename ...T>
  struct X {};
  
  int main() {
    X<int> x;
  }

->

  0x00000059:   DW_TAG_structure_type
                  DW_AT_calling_convention        (DW_CC_pass_by_value)
                  DW_AT_name      ("X<int>")
                  DW_AT_byte_size (0x01)
                  DW_AT_decl_file ("/home/teemperor/test/someoneshouldreallypaymeforthis.cpp")
                  DW_AT_decl_line (2)
  
  0x00000062:     DW_TAG_GNU_template_parameter_pack
                    DW_AT_name    ("T")
  
  0x00000067:       DW_TAG_template_type_parameter
                      DW_AT_type  (0x00000052 "int")
  
  0x0000006c:       NULL
  
  0x0000006d:     NULL
  
  0x0000006e:   NULL

I think having a fake class with a weird identifiers that contains template arguments is better than the missing arguments, so this looks in general good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126668



More information about the lldb-commits mailing list