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