Skip to content

Commit 8f0a6a8

Browse files
committed
Address PR suggestions - Part 1
1 parent d2b293a commit 8f0a6a8

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ def note_unsatisfied_trait_reason
17911791
"%NonStdLayoutBase{has a non-standard-layout base %1}|"
17921792
"%MixedAccess{has mixed access specifiers}|"
17931793
"%MultipleDataBase{has multiple base classes with data members}|"
1794-
"%VirtualFunction{has virtual functions}|"
1794+
"%VirtualFunction{has a virtual function}|"
17951795
"%NonStdLayoutMember{has a non-standard-layout member %1 of type %2}|"
17961796
"%IndirectBaseWithFields{has an indirect base %1 with data members}|"
17971797
"%DeletedDtr{has a %select{deleted|user-provided}1 destructor}|"

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

23222322
static 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

Comments
 (0)