brintos

brintos / llvm-project-archived public Read only

0
0
Text · 974 B · 2222c99 Raw
29 lines · cpp
1// RUN: %clang_analyze_cc1 -std=c++14 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=20 -verify %s2 3// A class that has no fields and one base class should visit that base class4// instead. Note that despite having excess padding of 2, this is flagged5// because of its usage in an array of 100 elements below (`ais').6// TODO: Add a note to the bug report with BugReport::addNote() to mention the7// variable using the class and also mention what class is inherting from what.8// expected-warning@+1{{Excessive padding in 'struct FakeIntSandwich'}}9struct FakeIntSandwich {10  char c1;11  int i;12  char c2;13};14 15struct AnotherIntSandwich : FakeIntSandwich { // no-warning16};17 18// But we don't yet support multiple base classes.19struct IntSandwich {};20struct TooManyBaseClasses : FakeIntSandwich, IntSandwich { // no-warning21};22 23AnotherIntSandwich ais[100];24 25struct Empty {};26struct DoubleEmpty : Empty { // no-warning27    Empty e;28};29