<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64291>64291</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Expression evaluator can't find member enum
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Endilll
      </td>
    </tr>
</table>

<pre>
    Consider the following code, which is a reduced example from [LLVM source code](https://github.com/llvm/llvm-project/blob/fa2b038cadf17d08014e5fb75c47b5024860953e/llvm/include/llvm/ADT/PointerIntPair.h#L168):
```cpp
using intptr_t = long;
using uintptr_t = unsigned long;

struct PointerIntPairInfo {
  enum MaskAndShiftConstants : uintptr_t {
 PointerBitMask = ~(uintptr_t)(((intptr_t)1 << 3) - 1),
  };

  int a{};

static uintptr_t foo() {
  return PointerIntPairInfo::PointerBitMask;
}

int main()
{
 PointerIntPairInfo p;
    __builtin_debugtrap();
    return p.a + foo();
}
```
Which is compiled with a nightly build of Clang: `clang test.cxx -g -glldb -o dwarf_test`.
LLDB fails to print both `MaskAndShiftConstants` and `PointerBitMask`:
```
(lldb) target create "dwarf_test"
Current executable set to '/home/user/endill/llvm-project/build-linux/dwarf_test' (x86_64).
(lldb) r
Process 4186406 launched: '/home/user/endill/llvm-project/build-linux/dwarf_test' (x86_64)
Process 4186406 stopped
* thread #1, name = 'dwarf_test', stop reason = signal SIGTRAP
    frame #0: 0x0000555555555739 dwarf_test`main at test.cxx:45:12
   42   {
   43       PointerIntPairInfo p;
   44 __builtin_debugtrap();
-> 45       return p.a + foo();
   46 }
(lldb) p sizeof(PointerIntPairInfo::MaskAndShiftConstants)
error: <user expression 0>:1:28: no member named 'MaskAndShiftConstants' in 'PointerIntPairInfo'
    1 | sizeof(PointerIntPairInfo::MaskAndShiftConstants)
      | ~~~~~~~~~~~~~~~~~~~~^
(lldb) p PointerIntPairInfo::PointerBitMask
error: <user expression 2>:1:21: no member named 'PointerBitMask' in 'PointerIntPairInfo'
    1 | PointerIntPairInfo::PointerBitMask
      | ~~~~~~~~~~~~~~~~~~~~^
```
Despite the fact that all the relevant information is present in debug info:
```
dwarf_test:     file format elf64-x86-64

.debug_info contents:
0x00000000: Compile Unit: length = 0x000000b9, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000bd)

0x0000000c: DW_TAG_compile_unit
 DW_AT_producer    ("Debian clang version 17.0.0 (++20230710111441+e16c5c092205-1~exp1~20230710111546.1433)")
 DW_AT_language    (DW_LANG_C_plus_plus_14)
              DW_AT_name ("test.cxx")
              DW_AT_LLVM_sysroot        ("/")
 DW_AT_str_offsets_base    (0x00000008)
              DW_AT_stmt_list (0x00000000)
              DW_AT_comp_dir ("/home/user/endill/llvm-project/build-linux")
 DW_AT_low_pc      (0x0000000000000000)
              DW_AT_ranges (indexed (0x0) rangelist = 0x00000010
 [0x0000000000001720, 0x0000000000001756)
 [0x0000000000001760, 0x000000000000176d)
 [0x0000000000001770, 0x0000000000001784))
              DW_AT_addr_base (0x00000008)
              DW_AT_rnglists_base (0x0000000c)

0x0000002c:   DW_TAG_structure_type
 DW_AT_calling_convention        (DW_CC_pass_by_value)
 DW_AT_name      ("PointerIntPairInfo")
                DW_AT_byte_size (0x04)
                DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line (7)

0x00000032:     DW_TAG_member
 DW_AT_name    ("a")
                  DW_AT_type    (0x0000005a "int")
                  DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line       (32)
                  DW_AT_data_member_location (0x00)

0x0000003b:     DW_TAG_enumeration_type
 DW_AT_type    (0x0000005e "uintptr_t")
                  DW_AT_name ("MaskAndShiftConstants")
                  DW_AT_byte_size (0x08)
                  DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line       (15)

0x00000044:       DW_TAG_enumerator
 DW_AT_name  ("PointerBitMask")
 DW_AT_const_value   (18446744073709551608)

0x00000050: NULL

0x00000051:     DW_TAG_subprogram
                  DW_AT_name ("PointerIntPairInfo")
                  DW_AT_declaration (true)
                  DW_AT_artificial      (true)
 DW_AT_external        (true)

0x00000053: DW_TAG_formal_parameter
                    DW_AT_type  (0x00000085 "PointerIntPairInfo *")
                    DW_AT_artificial (true)

0x00000058:       NULL

0x00000059: NULL

0x0000005a:   DW_TAG_base_type
                DW_AT_name ("int")
                DW_AT_encoding  (DW_ATE_signed)
 DW_AT_byte_size (0x04)

0x0000005e:   DW_TAG_typedef
 DW_AT_type      (0x00000066 "unsigned long")
 DW_AT_name      ("uintptr_t")
                DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line (2)

0x00000066:   DW_TAG_base_type
 DW_AT_name      ("unsigned long")
                DW_AT_encoding (DW_ATE_unsigned)
                DW_AT_byte_size (0x08)

0x0000006a:   DW_TAG_subprogram
                DW_AT_low_pc (0x0000000000001720)
                DW_AT_high_pc (0x0000000000001756)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_name      ("main")
 DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line (41)
                DW_AT_type (0x0000005a "int")
                DW_AT_external (true)

0x00000079:     DW_TAG_variable
 DW_AT_location        (DW_OP_fbreg -8)
                  DW_AT_name ("p")
                  DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line       (43)
                  DW_AT_type    (0x0000002c "PointerIntPairInfo")

0x00000084:     NULL

0x00000085: DW_TAG_pointer_type
                DW_AT_type      (0x0000002c "PointerIntPairInfo")

0x0000008a:   DW_TAG_subprogram
 DW_AT_low_pc    (0x0000000000001770)
                DW_AT_high_pc (0x0000000000001784)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_object_pointer    (0x0000009d)
 DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line (7)
                DW_AT_linkage_name ("_ZN18PointerIntPairInfoC2Ev")
                DW_AT_specification (0x00000051 "PointerIntPairInfo")

0x0000009d: DW_TAG_formal_parameter
                  DW_AT_location (DW_OP_fbreg -8)
                  DW_AT_name    ("this")
 DW_AT_type    (0x000000b7 "PointerIntPairInfo *")
 DW_AT_artificial      (true)

0x000000a6:     NULL

0x000000a7: DW_TAG_subprogram
                DW_AT_low_pc (0x0000000000001760)
                DW_AT_high_pc (0x000000000000176d)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_linkage_name      ("_ZL3foov")
 DW_AT_name      ("foo")
                DW_AT_decl_file ("/home/user/endill/llvm-project/build-linux/test.cxx")
 DW_AT_decl_line (35)
                DW_AT_type      (0x0000005e "uintptr_t")

0x000000b7:   DW_TAG_pointer_type
 DW_AT_type      (0x0000002c "PointerIntPairInfo")

0x000000bc: NULL
```

CC @JDevlieghere 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWt9v4zYS_muYl0EMifrphzw4dlz0kPaCNnsB-iJQEiXzSpMCRWWde9i__UDKsiVZjp3NXbfGIm1Ecvjxm5lvhnJIXbNSUHqHgnsUrG5IozdS3T2InHHOb1KZv90tpahZThXoDYVCci6_MlFCJnOK8BK-bli2AVYDAUXzJqM50B3ZVpxCoeQWUHD_-PivX6CWjcpouyxYIRxvtK5q5C0QXiO8LpneNOksk1uE15y_dv-5rZT8N800wuuUyxThdUFw6nhxRvLCjXIndlyfBkUaBZkfpYGD_Th05oFHj3aYyHiT9x4sVs8Ir58kE5qqn4V-IkzNNgh7j24YIzw3qJwVchYodNp_WVW1T5raHJ4JXWmVaEDeCrgUJfLu--PNYEIjLMv5cGb7s9aqyTQMsfwsCgko2k8EoKLZwi-k_nMh8t83rNDGJ5oIXQPyFv3dDmv2Bu-ZNussjG8Ix4ep5pQ4bv_1nrmAvCXylu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