diff options
| author | Yonghong Song <yhs@fb.com> | 2019-03-22 01:30:50 +0000 |
|---|---|---|
| committer | Yonghong Song <yhs@fb.com> | 2019-03-22 01:30:50 +0000 |
| commit | ded9a440d03f9c3f0825cef4f7ebc34fbe20e996 (patch) | |
| tree | a912a1323aba5aa2617f607703067ef2dbea74ba /llvm/lib/Target/BPF/BTFDebug.cpp | |
| parent | a73ac7d932e193f02c5a115be9d83d6778cf6560 (diff) | |
| download | bcm5719-llvm-ded9a440d03f9c3f0825cef4f7ebc34fbe20e996.tar.gz bcm5719-llvm-ded9a440d03f9c3f0825cef4f7ebc34fbe20e996.zip | |
[BPF] handle derived type properly for computing type id
Currently, the type id for a derived type is computed incorrectly.
For example,
type #1: int
type #2: ptr to #1
For a global variable "int *a", type #1 will be attributed to variable "a".
This is due to a bug which assigns the type id of the basetype of
that derived type as the derived type's type id. This happens
to "const", "volatile", "restrict", "typedef" and "pointer" types.
This patch fixed this bug, fixed existing test cases and added
a new one focusing on pointers plus other derived types.
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 356727
Diffstat (limited to 'llvm/lib/Target/BPF/BTFDebug.cpp')
| -rw-r--r-- | llvm/lib/Target/BPF/BTFDebug.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp index 01d3b9e9d00..f054933a2aa 100644 --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -511,7 +511,8 @@ void BTFDebug::visitDerivedType(const DIDerivedType *DTy, uint32_t &TypeId) { // Visit base type of pointer, typedef, const, volatile, restrict or // struct/union member. - visitTypeEntry(DTy->getBaseType().resolve(), TypeId); + uint32_t TempTypeId = 0; + visitTypeEntry(DTy->getBaseType().resolve(), TempTypeId); } void BTFDebug::visitTypeEntry(const DIType *Ty, uint32_t &TypeId) { |

