diff options
author | Bill Wendling <morbo@google.com> | 2024-10-17 21:52:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 21:52:40 +0000 |
commit | 8c62bf54df76e37d0978f4901c6be6554e978b53 (patch) | |
tree | 09379558f7ea504cb2c23ad050d9377928c26304 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | b060661da8b3b53db55644e5e358bb2dca8b56d7 (diff) | |
download | llvm-8c62bf54df76e37d0978f4901c6be6554e978b53.zip llvm-8c62bf54df76e37d0978f4901c6be6554e978b53.tar.gz llvm-8c62bf54df76e37d0978f4901c6be6554e978b53.tar.bz2 |
[Clang] Disable use of the counted_by attribute for whole struct pointers (#112636)
The whole struct is specificed in the __bdos. The calculation of the
whole size of the structure can be done in two ways:
1) sizeof(struct S) + count * sizeof(typeof(fam))
2) offsetof(struct S, fam) + count * sizeof(typeof(fam))
The first will add any remaining whitespace that might exist after
allocation while the second method is more precise, but not quite
expected from programmers. See [1] for a discussion of the topic.
GCC isn't (currently) able to calculate __bdos on a pointer to the whole
structure. Therefore, because of the above issue, we'll choose to match
what GCC does for consistency's sake.
[1] https://lore.kernel.org/lkml/ZvV6X5FPBBW7CO1f@archlinux/
Co-authored-by: Eli Friedman <efriedma@quicinc.com>
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
0 files changed, 0 insertions, 0 deletions