[PATCH] D82041: [BPF] fix a bug for BTF pointee type pruning
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 17 13:29:28 PDT 2020
yonghong-song marked an inline comment as done.
yonghong-song added inline comments.
================
Comment at: llvm/lib/Target/BPF/BTFDebug.cpp:606
bool CheckPointer, bool SeenPointer) {
if (!Ty || DIToIdMap.find(Ty) != DIToIdMap.end()) {
TypeId = DIToIdMap[Ty];
----------------
anakryiko wrote:
> if it is the `!Ty` case, would it crash immediately one line below? Was it supposed to be `if (Ty && DIToIdMap.find(Ty) != DIToIdMap.end())`?
It should not crash. The intention is if Ty is null, then DIToIdMap[Ty] will return TypeId 0.
Note that DIToIdMap is a map, the key is a pointer, so it won't crash even if the pointer
value is null. We do have cases where e.g., Ty->getBaseType() is null. For example, `const void` where the type pointed by const is null type and its type id is 0.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82041/new/
https://reviews.llvm.org/D82041
More information about the llvm-commits
mailing list