[llvm] [BPF] Visit nested map array during BTF generation (PR #150608)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 04:16:14 PDT 2025


mtardy wrote:

> First, I think that there is no need to modify `visitTypeEntry` at all, the changes can be confined to `visitMapDefType`, as in [this commit](https://github.com/llvm/llvm-project/commit/87326998aecd464723822a7429b6aaa9ff708be5).

Ah nice, I thought we needed to `visitDerivedType` anyway to generated the BTF type for the pointers to the map type (so I wrote such patch, skipping just `visitTypeEntry`), but it seems the `visitTypeEntry` at the end of `visitMapDefType` does the job (in a different order, thus the unit test BTF output modification). Thank you!

> Second, I think that `visitMapDefType` should be refactored to make intent more clear, as in [this commit](https://github.com/llvm/llvm-project/commit/86838de43e58ba733e6e691f3859da293c555949).

Agree, it's better this way, only logical difference is you don't return on `CTy->isForwardDecl()`. I imagine you noticed and it's okay but just saying.

https://github.com/llvm/llvm-project/blob/2f2df751d453566ab70fd02b9a019cd66af76bc6/llvm/lib/Target/BPF/BTFDebug.cpp#L976-L977



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


More information about the llvm-commits mailing list