// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -std=c++14 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify %s
// expected-warning@+7{{\
Excessive padding in 'struct IntSandwich' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
;
// expected-warning@+7{{\
Excessive padding in 'struct TurDuckHen' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
;
// expected-warning@+11{{\
Excessive padding in 'struct SmallIntSandwich' (4 padding bytes, where 0 is optimal). \
Optimal fields order: \
i1, \
i2, \
i3, \
c1, \
c2, \
c3, \
c4, \
}}
;
;
// expected-warning@+7{{\
Excessive padding in 'struct HoldsAUnion' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
u, \
c1, \
c2, \
}}
;
;
;
// expected-warning@+7{{\
Excessive padding in 'struct StructSandwich' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
m, \
s, \
s2, \
}}
;
// expected-warning@+7{{\
Excessive padding in 'TypedefSandwich' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
typedef struct TypedefSandwich;
// expected-warning@+7{{\
Excessive padding in 'struct StructAttrAlign' (10 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
;
// expected-warning@+8{{\
Excessive padding in 'struct OverlyAlignedChar' (8185 padding bytes, where 4089 is optimal). \
Optimal fields order: \
c, \
c1, \
c2, \
x, \
}}
;
// expected-warning@+7{{\
Excessive padding in 'struct HoldsOverlyAlignedChar' (8190 padding bytes, where 4094 is optimal). \
Optimal fields order: \
o, \
c1, \
c2, \
}}
;
void
void
// expected-warning@+7{{\
Excessive padding in 'struct DefaultAttrAlign' (22 padding bytes, where 6 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
;
// expected-warning@+7{{\
Excessive padding in 'struct SmallArrayShortSandwich' (2 padding bytes, where 0 is optimal). \
Optimal fields order: \
s, \
c1, \
c2, \
}}
ShortArray;
// expected-warning@+7{{\
Excessive padding in 'struct SmallArrayInFunc' (2 padding bytes, where 0 is optimal). \
Optimal fields order: \
s, \
c1, \
c2, \
}}
;
void
// expected-warning@+7{{\
Excessive padding in 'class VirtualIntSandwich' (10 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
c1, \
c2, \
}}
;
// constructed so as not to have tail padding
// expected-warning@+8{{\
Excessive padding in 'class InnerPaddedB' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
i1, \
i2, \
c1, \
c2, \
}}
;
; // no-warning
// expected-warning@+7{{\
Excessive padding in 'class LotsOfSpace' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
i, \
e1, \
e2, \
}}
;
// expected-warning@+7{{\
Excessive padding in 'struct TypedefSandwich2' (6 padding bytes, where 2 is optimal). \
Optimal fields order: \
t, \
c1, \
c2, \
}}
typedef struct TypedefSandwich2 TypedefSandwich2;
;
;