@@ -4034,13 +4034,13 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
4034
4034
} else {
4035
4035
Diag(NewMethod->getLocation(),
4036
4036
diag::err_definition_of_implicitly_declared_member)
4037
- << New << getSpecialMember(OldMethod);
4037
+ << New << llvm::to_underlying( getSpecialMember(OldMethod) );
4038
4038
return true;
4039
4039
}
4040
4040
} else if (OldMethod->getFirstDecl()->isExplicitlyDefaulted() && !isFriend) {
4041
4041
Diag(NewMethod->getLocation(),
4042
4042
diag::err_definition_of_explicitly_defaulted_member)
4043
- << getSpecialMember(OldMethod);
4043
+ << llvm::to_underlying( getSpecialMember(OldMethod) );
4044
4044
return true;
4045
4045
}
4046
4046
}
@@ -5249,7 +5249,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
5249
5249
if (DS.isModulePrivateSpecified() &&
5250
5250
Tag && Tag->getDeclContext()->isFunctionOrMethod())
5251
5251
Diag(DS.getModulePrivateSpecLoc(), diag::err_module_private_local_class)
5252
- << Tag->getTagKind()
5252
+ << llvm::to_underlying( Tag->getTagKind() )
5253
5253
<< FixItHint::CreateRemoval(DS.getModulePrivateSpecLoc());
5254
5254
5255
5255
ActOnDocumentableDecl(TagD);
@@ -7722,14 +7722,15 @@ NamedDecl *Sema::ActOnVariableDeclarator(
7722
7722
// data members.
7723
7723
Diag(D.getIdentifierLoc(),
7724
7724
diag::err_static_data_member_not_allowed_in_local_class)
7725
- << Name << RD->getDeclName() << RD->getTagKind();
7725
+ << Name << RD->getDeclName()
7726
+ << llvm::to_underlying(RD->getTagKind());
7726
7727
} else if (AnonStruct) {
7727
7728
// C++ [class.static.data]p4: Unnamed classes and classes contained
7728
7729
// directly or indirectly within unnamed classes shall not contain
7729
7730
// static data members.
7730
7731
Diag(D.getIdentifierLoc(),
7731
7732
diag::err_static_data_member_not_allowed_in_anon_struct)
7732
- << Name << AnonStruct->getTagKind();
7733
+ << Name << llvm::to_underlying( AnonStruct->getTagKind() );
7733
7734
Invalid = true;
7734
7735
} else if (RD->isUnion()) {
7735
7736
// C++98 [class.union]p1: If a union contains a static data member,
@@ -17660,7 +17661,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
17660
17661
17661
17662
// A tag 'foo::bar' must already exist.
17662
17663
Diag(NameLoc, diag::err_not_tag_in_scope)
17663
- << Kind << Name << DC << SS.getRange();
17664
+ << llvm::to_underlying( Kind) << Name << DC << SS.getRange();
17664
17665
Name = nullptr;
17665
17666
Invalid = true;
17666
17667
goto CreateNewDecl;
@@ -18118,7 +18119,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
18118
18119
!Previous.isForRedeclaration()) {
18119
18120
NonTagKind NTK = getNonTagTypeDeclKind(PrevDecl, Kind);
18120
18121
Diag(NameLoc, diag::err_tag_reference_non_tag)
18121
- << PrevDecl << NTK << Kind;
18122
+ << PrevDecl << NTK << llvm::to_underlying( Kind) ;
18122
18123
Diag(PrevDecl->getLocation(), diag::note_declared_at);
18123
18124
Invalid = true;
18124
18125
@@ -19017,7 +19018,8 @@ bool Sema::CheckNontrivialField(FieldDecl *FD) {
19017
19018
getLangOpts().CPlusPlus11
19018
19019
? diag::warn_cxx98_compat_nontrivial_union_or_anon_struct_member
19019
19020
: diag::err_illegal_union_or_anon_struct_member)
19020
- << FD->getParent()->isUnion() << FD->getDeclName() << member;
19021
+ << FD->getParent()->isUnion() << FD->getDeclName()
19022
+ << llvm::to_underlying(member);
19021
19023
DiagnoseNontrivial(RDecl, member);
19022
19024
return !getLangOpts().CPlusPlus11;
19023
19025
}
@@ -19357,7 +19359,8 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
19357
19359
unsigned DiagID = 0;
19358
19360
if (!Record->isUnion() && !IsLastField) {
19359
19361
Diag(FD->getLocation(), diag::err_flexible_array_not_at_end)
19360
- << FD->getDeclName() << FD->getType() << Record->getTagKind();
19362
+ << FD->getDeclName() << FD->getType()
19363
+ << llvm::to_underlying(Record->getTagKind());
19361
19364
Diag((*(i + 1))->getLocation(), diag::note_next_field_declaration);
19362
19365
FD->setInvalidDecl();
19363
19366
EnclosingDecl->setInvalidDecl();
@@ -19373,18 +19376,18 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
19373
19376
19374
19377
if (DiagID)
19375
19378
Diag(FD->getLocation(), DiagID)
19376
- << FD->getDeclName() << Record->getTagKind();
19379
+ << FD->getDeclName() << llvm::to_underlying( Record->getTagKind() );
19377
19380
// While the layout of types that contain virtual bases is not specified
19378
19381
// by the C++ standard, both the Itanium and Microsoft C++ ABIs place
19379
19382
// virtual bases after the derived members. This would make a flexible
19380
19383
// array member declared at the end of an object not adjacent to the end
19381
19384
// of the type.
19382
19385
if (CXXRecord && CXXRecord->getNumVBases() != 0)
19383
19386
Diag(FD->getLocation(), diag::err_flexible_array_virtual_base)
19384
- << FD->getDeclName() << Record->getTagKind();
19387
+ << FD->getDeclName() << llvm::to_underlying( Record->getTagKind() );
19385
19388
if (!getLangOpts().C99)
19386
19389
Diag(FD->getLocation(), diag::ext_c99_flexible_array_member)
19387
- << FD->getDeclName() << Record->getTagKind();
19390
+ << FD->getDeclName() << llvm::to_underlying( Record->getTagKind() );
19388
19391
19389
19392
// If the element type has a non-trivial destructor, we would not
19390
19393
// implicitly destroy the elements, so disallow it for now.
0 commit comments