[clang][NFC] Convert `Parser::CachedInitKind` to scoped enum
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 4158712..2804699 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -84,6 +84,8 @@
ExplicitInstantiation
};
+enum class CachedInitKind { DefaultArgument, DefaultInitializer };
+
/// Parser - This implements a parser for the C family of languages. After
/// parsing units of the grammar, productions are invoked to handle whatever has
/// been read.
@@ -1646,11 +1648,6 @@
void DeallocateParsedClasses(ParsingClass *Class);
void PopParsingClass(Sema::ParsingClassState);
- enum CachedInitKind {
- CIK_DefaultArgument,
- CIK_DefaultInitializer
- };
-
NamedDecl *ParseCXXInlineMethodDef(AccessSpecifier AS,
const ParsedAttributesView &AccessAttrs,
ParsingDeclarator &D,
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index 78eddfa..e76435d 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -266,7 +266,7 @@
ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/true);
} else {
// Consume everything up to (but excluding) the comma or semicolon.
- ConsumeAndStoreInitializer(Toks, CIK_DefaultInitializer);
+ ConsumeAndStoreInitializer(Toks, CachedInitKind::DefaultInitializer);
}
// Store an artificial EOF token to ensure that we don't run off the end of
@@ -1238,7 +1238,7 @@
TPResult Result = TPResult::Error;
ConsumeToken();
switch (CIK) {
- case CIK_DefaultInitializer:
+ case CachedInitKind::DefaultInitializer:
Result = TryParseInitDeclaratorList();
// If we parsed a complete, ambiguous init-declarator-list, this
// is only syntactically-valid if it's followed by a semicolon.
@@ -1246,7 +1246,7 @@
Result = TPResult::False;
break;
- case CIK_DefaultArgument:
+ case CachedInitKind::DefaultArgument:
bool InvalidAsDeclaration = false;
Result = TryParseParameterDeclarationClause(
&InvalidAsDeclaration, /*VersusTemplateArg=*/true);
@@ -1372,7 +1372,7 @@
// and return it. Otherwise, this is a spurious RHS token, which we
// consume and pass on to downstream code to diagnose.
case tok::r_paren:
- if (CIK == CIK_DefaultArgument)
+ if (CIK == CachedInitKind::DefaultArgument)
return true; // End of the default argument.
if (ParenCount && !IsFirstToken)
return false;
@@ -1406,7 +1406,7 @@
ConsumeStringToken();
break;
case tok::semi:
- if (CIK == CIK_DefaultInitializer)
+ if (CIK == CachedInitKind::DefaultInitializer)
return true; // End of the default initializer.
[[fallthrough]];
default:
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 5f52193..ec3e3ca 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -8156,7 +8156,8 @@
DefArgToks.reset(new CachedTokens);
SourceLocation ArgStartLoc = NextToken().getLocation();
- ConsumeAndStoreInitializer(*DefArgToks, CIK_DefaultArgument);
+ ConsumeAndStoreInitializer(*DefArgToks,
+ CachedInitKind::DefaultArgument);
Actions.ActOnParamUnparsedDefaultArgument(Param, EqualLoc,
ArgStartLoc);
} else {