[analyzer] Fix calculating offset for fields with an empty type
authorGeorgy Komarov <jubnzv@gmail.com>
Fri, 28 May 2021 08:58:50 +0000 (11:58 +0300)
committerGeorgy Komarov <jubnzv@gmail.com>
Sun, 4 Jul 2021 03:57:11 +0000 (06:57 +0300)
commitc558b1fca7350f4f4d8e7387fb2ead951284a5cf
tree979a80f6859fcc275b5a3db87975331b2ef9e995
parent89c1c64cc3170a05a881bb9954feafc3edca6704
[analyzer] Fix calculating offset for fields with an empty type

Fix offset calculation routines in padding checker to avoid assertion
errors described in bugzilla issue 50426. The fields that are subojbects
of zero size, marked with [[no_unique_address]] or empty bitfields will
be excluded from padding calculation routines.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D104097
clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
clang/test/Analysis/padding_no_unique_address.cpp [new file with mode: 0644]