32
32
#include " clang/Sema/SemaDiagnostic.h"
33
33
#include " clang/Sema/SemaObjC.h"
34
34
#include " clang/Sema/SemaOpenMP.h"
35
+ #include " llvm/ADT/STLForwardCompat.h"
35
36
#include " llvm/ADT/SmallSet.h"
36
37
#include " llvm/ADT/SmallString.h"
37
38
#include " llvm/ADT/StringSwitch.h"
@@ -2335,8 +2336,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
2335
2336
D.setTemplateParameterLists (*TemplateInfo.TemplateParams );
2336
2337
2337
2338
bool IsTemplateSpecOrInst =
2338
- (TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitInstantiation ||
2339
- TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitSpecialization);
2339
+ (TemplateInfo.Kind == ParsedTemplateKind ::ExplicitInstantiation ||
2340
+ TemplateInfo.Kind == ParsedTemplateKind ::ExplicitSpecialization);
2340
2341
SuppressAccessChecks SAC (*this , IsTemplateSpecOrInst);
2341
2342
2342
2343
ParseDeclarator (D);
@@ -2427,7 +2428,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
2427
2428
}
2428
2429
Decl *TheDecl = nullptr ;
2429
2430
2430
- if (TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitInstantiation) {
2431
+ if (TemplateInfo.Kind == ParsedTemplateKind ::ExplicitInstantiation) {
2431
2432
if (D.getName ().getKind () != UnqualifiedIdKind::IK_TemplateId) {
2432
2433
// If the declarator-id is not a template-id, issue a diagnostic
2433
2434
// and recover by ignoring the 'template' keyword.
@@ -2574,10 +2575,10 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
2574
2575
// In a template-declaration, explicit specialization, or explicit
2575
2576
// instantiation the init-declarator-list in the declaration shall
2576
2577
// contain at most one declarator.
2577
- if (TemplateInfo.Kind != ParsedTemplateInfo ::NonTemplate &&
2578
+ if (TemplateInfo.Kind != ParsedTemplateKind ::NonTemplate &&
2578
2579
D.isFirstDeclarator ()) {
2579
2580
Diag (CommaLoc, diag::err_multiple_template_declarators)
2580
- << TemplateInfo.Kind ;
2581
+ << llvm::to_underlying ( TemplateInfo.Kind ) ;
2581
2582
}
2582
2583
2583
2584
// Parse the next declarator.
@@ -2740,12 +2741,12 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
2740
2741
Decl *ThisDecl = nullptr ;
2741
2742
Decl *OuterDecl = nullptr ;
2742
2743
switch (TemplateInfo.Kind ) {
2743
- case ParsedTemplateInfo ::NonTemplate:
2744
+ case ParsedTemplateKind ::NonTemplate:
2744
2745
ThisDecl = Actions.ActOnDeclarator (getCurScope (), D);
2745
2746
break ;
2746
2747
2747
- case ParsedTemplateInfo ::Template:
2748
- case ParsedTemplateInfo ::ExplicitSpecialization: {
2748
+ case ParsedTemplateKind ::Template:
2749
+ case ParsedTemplateKind ::ExplicitSpecialization: {
2749
2750
ThisDecl = Actions.ActOnTemplateDeclarator (getCurScope (),
2750
2751
*TemplateInfo.TemplateParams ,
2751
2752
D);
@@ -2757,7 +2758,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
2757
2758
}
2758
2759
break ;
2759
2760
}
2760
- case ParsedTemplateInfo ::ExplicitInstantiation: {
2761
+ case ParsedTemplateKind ::ExplicitInstantiation: {
2761
2762
if (Tok.is (tok::semi)) {
2762
2763
DeclResult ThisRes = Actions.ActOnExplicitInstantiation (
2763
2764
getCurScope (), TemplateInfo.ExternLoc , TemplateInfo.TemplateLoc , D);
@@ -3711,8 +3712,8 @@ void Parser::ParseDeclarationSpecifiers(
3711
3712
// Turn off usual access checking for template specializations and
3712
3713
// instantiations.
3713
3714
bool IsTemplateSpecOrInst =
3714
- (TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitInstantiation ||
3715
- TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitSpecialization);
3715
+ (TemplateInfo.Kind == ParsedTemplateKind ::ExplicitInstantiation ||
3716
+ TemplateInfo.Kind == ParsedTemplateKind ::ExplicitSpecialization);
3716
3717
3717
3718
switch (Tok.getKind ()) {
3718
3719
default :
@@ -3817,7 +3818,7 @@ void Parser::ParseDeclarationSpecifiers(
3817
3818
}
3818
3819
3819
3820
// Class context can appear inside a function/block, so prioritise that.
3820
- if (TemplateInfo.Kind != ParsedTemplateInfo ::NonTemplate)
3821
+ if (TemplateInfo.Kind != ParsedTemplateKind ::NonTemplate)
3821
3822
CCC = DSContext == DeclSpecContext::DSC_class
3822
3823
? SemaCodeCompletion::PCC_MemberTemplate
3823
3824
: SemaCodeCompletion::PCC_Template;
@@ -5369,8 +5370,8 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
5369
5370
// we don't suppress if this turns out to be an elaborated type
5370
5371
// specifier.
5371
5372
bool shouldDelayDiagsInTag =
5372
- (TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitInstantiation ||
5373
- TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitSpecialization);
5373
+ (TemplateInfo.Kind == ParsedTemplateKind ::ExplicitInstantiation ||
5374
+ TemplateInfo.Kind == ParsedTemplateKind ::ExplicitSpecialization);
5374
5375
SuppressAccessChecks diagsFromTag (*this , shouldDelayDiagsInTag);
5375
5376
5376
5377
// Determine whether this declaration is permitted to have an enum-base.
@@ -5567,7 +5568,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
5567
5568
}
5568
5569
5569
5570
MultiTemplateParamsArg TParams;
5570
- if (TemplateInfo.Kind != ParsedTemplateInfo ::NonTemplate &&
5571
+ if (TemplateInfo.Kind != ParsedTemplateKind ::NonTemplate &&
5571
5572
TUK != TagUseKind::Reference) {
5572
5573
if (!getLangOpts ().CPlusPlus11 || !SS.isSet ()) {
5573
5574
// Skip the rest of this declarator, up until the comma or semicolon.
@@ -5576,7 +5577,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
5576
5577
return ;
5577
5578
}
5578
5579
5579
- if (TemplateInfo.Kind == ParsedTemplateInfo ::ExplicitInstantiation) {
5580
+ if (TemplateInfo.Kind == ParsedTemplateKind ::ExplicitInstantiation) {
5580
5581
// Enumerations can't be explicitly instantiated.
5581
5582
DS.SetTypeSpecError ();
5582
5583
Diag (StartLoc, diag::err_explicit_instantiation_enum);
0 commit comments