@@ -2293,11 +2293,10 @@ static bool hasMixedAccessSpecifier(const CXXRecordDecl *D) {
22932293 if (Field->isUnnamedBitField ())
22942294 continue ;
22952295 AccessSpecifier FieldAccess = Field->getAccess ();
2296- if (FirstAccess == AS_none) {
2296+ if (FirstAccess == AS_none)
22972297 FirstAccess = FieldAccess;
2298- } else if (FieldAccess != FirstAccess) {
2298+ else if (FieldAccess != FirstAccess)
22992299 return true ;
2300- }
23012300 }
23022301 return false ;
23032302}
@@ -2311,12 +2310,13 @@ static bool hasMultipleDataBaseClassesWithFields(const CXXRecordDecl *D) {
23112310
23122311 for (const FieldDecl *Field : BaseRD->fields ()) {
23132312 if (!Field->isUnnamedBitField ()) {
2314- ++NumBasesWithFields;
2315- break ; // Only count the base once.
2313+ if (++NumBasesWithFields > 1 )
2314+ return true ; // found more than one base class with fields
2315+ break ; // no need to check further fields in this base class
23162316 }
23172317 }
23182318 }
2319- return NumBasesWithFields > 1 ;
2319+ return false ;
23202320}
23212321
23222322static void DiagnoseNonStandardLayoutReason (Sema &SemaRef, SourceLocation Loc,
@@ -2353,7 +2353,7 @@ static void DiagnoseNonStandardLayoutReason(Sema &SemaRef, SourceLocation Loc,
23532353 << Field->getType () << Field->getSourceRange ();
23542354 }
23552355 }
2356- // find any indirect base classes that have fields
2356+ // Find any indirect base classes that have fields.
23572357 if (D->hasDirectFields ()) {
23582358 const CXXRecordDecl *Indirect = nullptr ;
23592359 D->forallBases ([&](const CXXRecordDecl *BaseDef) {
@@ -2376,7 +2376,7 @@ static void DiagnoseNonStandardLayoutReason(Sema &SemaRef, SourceLocation Loc,
23762376 SemaRef.Diag (Loc, diag::note_unsatisfied_trait)
23772377 << T << diag::TraitName::StandardLayout;
23782378
2379- // Check type-level exclusion first
2379+ // Check type-level exclusion first.
23802380 if (T->isVariablyModifiedType ()) {
23812381 SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
23822382 << diag::TraitNotSatisfiedReason::VLA;
0 commit comments