[llvm] [BPF] Support for `DW_TAG_variant_part` in BTF generation (PR #155783)
Tamir Duberstein via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 17 12:26:05 PDT 2025
================
@@ -672,16 +714,23 @@ void BTFDebug::visitStructType(const DICompositeType *CTy, bool IsStruct,
uint32_t &TypeId) {
const DINodeArray Elements = CTy->getElements();
uint32_t VLen = Elements.size();
+ // Variant parts have a discriminator. LLVM DI doesn't consider it as an
+ // element and instead keeps it as a separate reference. But we represent it
+ // as an element in BTF.
+ if (CTy->getTag() == dwarf::DW_TAG_variant_part)
+ VLen++;
----------------
tamird wrote:
Yeah I'm sure you're right. Still, extracting a local saves me from having to squint to see that the same expression is evaluated twice.
https://github.com/llvm/llvm-project/pull/155783
More information about the llvm-commits
mailing list