[llvm] [BPF] Handle data-carrying enums (PR #155783)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 11:13:30 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)) {
----------------
eddyz87 wrote:
I'd match the tag directly here:
```c++
switch(Elem->getTag()) {
case dwarf::DW_TAG_member: ...
case dwarf::DW_TAG_variant_part: ...
}
```
Also, I'd generate an artificial field for the variant part, if that is possible.
https://github.com/llvm/llvm-project/pull/155783
More information about the llvm-commits
mailing list