| 1 |
// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-linux-gnu -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify %s |
| 2 |
|
| 3 |
class Empty {}; // no-warning |
| 4 |
|
| 5 |
// expected-warning@+1{{Excessive padding in 'struct NoUniqueAddressWarn1' (6 padding}} |
| 6 |
struct NoUniqueAddressWarn1 { |
| 7 |
char c1; |
| 8 |
[[no_unique_address]] Empty empty; |
| 9 |
int i; |
| 10 |
char c2; |
| 11 |
}; |
| 12 |
|
| 13 |
// expected-warning@+1{{Excessive padding in 'struct NoUniqueAddressWarn2' (6 padding}} |
| 14 |
struct NoUniqueAddressWarn2 { |
| 15 |
char c1; |
| 16 |
[[no_unique_address]] Empty e1, e2; |
| 17 |
int i; |
| 18 |
char c2; |
| 19 |
}; |
| 20 |
|
| 21 |
struct NoUniqueAddressNoWarn1 { |
| 22 |
char c1; |
| 23 |
[[no_unique_address]] Empty empty; |
| 24 |
char c2; |
| 25 |
}; |
| 26 |
|
| 27 |
struct NoUniqueAddressNoWarn2 { |
| 28 |
char c1; |
| 29 |
[[no_unique_address]] Empty e1, e2; |
| 30 |
}; |