[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Resolve nested types when parsing structures (PR #66879)

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 20 02:48:12 PDT 2023


================
@@ -462,3 +462,96 @@ TEST_F(DWARFASTParserClangTests, TestDefaultTemplateParamParsing) {
     }
   }
 }
+
+TEST_F(DWARFASTParserClangTests, EnsureNestedTypesOfTypeAreParsed) {
+  const char *yamldata = R"(
----------------
Endilll wrote:

I find this YAML way of describing debug info quite unfriendly, especially compared to the output of `llvm-dwarfdump`. Anyway, I tried to encode debug info for the following snippet:
```cpp
struct Info {
  enum Mask : uintptr_t {
    Enum =  ~(uintptr_t)(((intptr_t)1 << 3) - 1);
  };
  union B {};
  struct C {};
}
```
Filtered out llvm-dwarfdump output:
```
0x0000000c: DW_TAG_compile_unit
              DW_AT_language [DW_FORM_data2]    (DW_LANG_C_plus_plus_14)

0x0000002c:   DW_TAG_structure_type
                DW_AT_calling_convention [DW_FORM_data1]        (DW_CC_pass_by_value)
                DW_AT_name [DW_FORM_strx1]      ("Info")
                DW_AT_byte_size [DW_FORM_data1] (0x04)

0x0000003a:     DW_TAG_union_type
                  DW_AT_calling_convention [DW_FORM_data1]      (DW_CC_pass_by_value)
                  DW_AT_name [DW_FORM_strx1]    ("B")
                  DW_AT_byte_size [DW_FORM_data1]       (0x01)

0x00000049:     DW_TAG_structure_type
                  DW_AT_calling_convention [DW_FORM_data1]      (DW_CC_pass_by_value)
                  DW_AT_name [DW_FORM_strx1]    ("C")
                  DW_AT_byte_size [DW_FORM_data1]       (0x01)

0x0000003b:     DW_TAG_enumeration_type
                  DW_AT_type [DW_FORM_ref4]     (0x0000005e "uintptr_t")
                  DW_AT_name [DW_FORM_strx1]    ("Mask")
                  DW_AT_byte_size [DW_FORM_data1]       (0x08)

0x00000044:       DW_TAG_enumerator
                    DW_AT_name [DW_FORM_strx1]  ("Enum")
                    DW_AT_const_value [DW_FORM_udata]   (18446744073709551608)
```

https://github.com/llvm/llvm-project/pull/66879


More information about the lldb-commits mailing list