[Lldb-commits] [lldb] [lldb] Fix expressions that involve nested structs/classes/unions. (PR #77029)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 5 09:02:31 PST 2024


================
@@ -3106,10 +3115,39 @@ void DWARFASTParserClang::ParseSingleMember(
       std::make_pair(field_decl, field_bit_offset));
 }
 
+static bool IsTypeTag(dw_tag_t tag) {
+  switch (tag) {
+    case DW_TAG_typedef:
+    case DW_TAG_base_type:
+    case DW_TAG_pointer_type:
+    case DW_TAG_reference_type:
+    case DW_TAG_rvalue_reference_type:
+    case DW_TAG_const_type:
+    case DW_TAG_restrict_type:
+    case DW_TAG_volatile_type:
+    case DW_TAG_atomic_type:
+    case DW_TAG_unspecified_type:
+    case DW_TAG_structure_type:
+    case DW_TAG_union_type:
+    case DW_TAG_class_type:
+    case DW_TAG_enumeration_type:
+    case DW_TAG_inlined_subroutine:
+    case DW_TAG_subprogram:
+    case DW_TAG_subroutine_type:
+    case DW_TAG_array_type:
+    case DW_TAG_ptr_to_member_type:
+      return true;
+    default:
+      break;
+  }
+  return false;
+}
----------------
clayborg wrote:

I tried to find this function, but was able to find it because `llvm::dwarf::isType` uses the #include style to make the contents which is not readable or grep'able:
```
inline bool isType(Tag T) {
  switch (T) {
  default:
    return false;
#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND)                         \
  case DW_TAG_##NAME:                                                          \
    return (KIND == DW_KIND_TYPE);
#include "llvm/BinaryFormat/Dwarf.def"
  }
}
```
No wonder I couldn't find it with a code grep! Thanks for the pointer, I will use this

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


More information about the lldb-commits mailing list