[llvm] [BPF] Handle data-carrying enums (PR #155783)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 11:52:02 PDT 2025
================
@@ -696,10 +710,14 @@ void BTFDebug::visitStructType(const DICompositeType *CTy, bool IsStruct,
// Visit all struct members.
int FieldNo = 0;
for (const auto *Element : Elements) {
- const auto Elem = cast<DIDerivedType>(Element);
- visitTypeEntry(Elem);
- processDeclAnnotations(Elem->getAnnotations(), TypeId, FieldNo);
- FieldNo++;
+ if (const auto *Elem = dyn_cast<DIDerivedType>(Element)) {
+ visitTypeEntry(Elem);
+ processDeclAnnotations(Elem->getAnnotations(), TypeId, FieldNo);
+ FieldNo++;
+ } else if (const auto *Elem = dyn_cast<DICompositeType>(Element)) {
+ auto Tag = CTy->getTag();
+ visitStructType(Elem, Tag == dwarf::DW_TAG_structure_type, TypeId);
----------------
eddyz87 wrote:
Also, maybe route the Elem via `visitTypeEntry`, extending it to support `DW_TAG_variant` / `DW_TAG_variant_part`?
So that processing remains more or less uniform.
https://github.com/llvm/llvm-project/pull/155783
More information about the llvm-commits
mailing list