@@ -647,8 +647,8 @@ class AnnotatingParser {
647647 return true ;
648648
649649 // Limit this to being an access modifier that follows.
650- if (AttrTok->isOneOf (tok::kw_public, tok::kw_private, tok::kw_protected,
651- tok::comment, tok::kw_class, tok::kw_static,
650+ if (AttrTok->isAccessSpecifierKeyword () ||
651+ AttrTok-> isOneOf ( tok::comment, tok::kw_class, tok::kw_static,
652652 tok::l_square, Keywords.kw_internal )) {
653653 return true ;
654654 }
@@ -1419,7 +1419,7 @@ class AnnotatingParser {
14191419 Tok->setType (TT_CtorInitializerColon);
14201420 } else {
14211421 Tok->setType (TT_InheritanceColon);
1422- if (Prev->isOneOf (tok::kw_public, tok::kw_private, tok::kw_protected ))
1422+ if (Prev->isAccessSpecifierKeyword ( ))
14231423 Line.Type = LT_AccessModifier;
14241424 }
14251425 } else if (canBeObjCSelectorComponent (*Tok->Previous ) && Tok->Next &&
@@ -2333,7 +2333,7 @@ class AnnotatingParser {
23332333 if (Current.Previous ) {
23342334 bool IsIdentifier =
23352335 Style.isJavaScript ()
2336- ? Keywords.IsJavaScriptIdentifier (
2336+ ? Keywords.isJavaScriptIdentifier (
23372337 *Current.Previous , /* AcceptIdentifierName= */ true )
23382338 : Current.Previous ->is (tok::identifier);
23392339 if (IsIdentifier ||
@@ -4949,11 +4949,11 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
49494949
49504950 // space between method modifier and opening parenthesis of a tuple return
49514951 // type
4952- if (Left.isOneOf (tok::kw_public, tok::kw_private, tok::kw_protected,
4953- tok::kw_virtual, tok::kw_extern, tok::kw_static,
4954- Keywords.kw_internal , Keywords.kw_abstract ,
4955- Keywords.kw_sealed , Keywords.kw_override ,
4956- Keywords.kw_async , Keywords.kw_unsafe ) &&
4952+ if (( Left.isAccessSpecifierKeyword () ||
4953+ Left. isOneOf ( tok::kw_virtual, tok::kw_extern, tok::kw_static,
4954+ Keywords.kw_internal , Keywords.kw_abstract ,
4955+ Keywords.kw_sealed , Keywords.kw_override ,
4956+ Keywords.kw_async , Keywords.kw_unsafe ) ) &&
49574957 Right.is (tok::l_paren)) {
49584958 return true ;
49594959 }
@@ -4979,7 +4979,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
49794979 }
49804980 // In tagged template literals ("html`bar baz`"), there is no space between
49814981 // the tag identifier and the template string.
4982- if (Keywords.IsJavaScriptIdentifier (Left,
4982+ if (Keywords.isJavaScriptIdentifier (Left,
49834983 /* AcceptIdentifierName= */ false ) &&
49844984 Right.is (TT_TemplateString)) {
49854985 return false ;
@@ -5074,9 +5074,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
50745074 return Style.SpaceBeforeParensOptions .AfterControlStatements ||
50755075 spaceRequiredBeforeParens (Right);
50765076 }
5077- if ((Left.isOneOf (tok::kw_static, tok::kw_public, tok::kw_private,
5078- tok::kw_protected) ||
5079- Left.isOneOf (Keywords.kw_final , Keywords.kw_abstract ,
5077+ if ((Left.isAccessSpecifierKeyword () ||
5078+ Left.isOneOf (tok::kw_static, Keywords.kw_final , Keywords.kw_abstract ,
50805079 Keywords.kw_native )) &&
50815080 Right.is (TT_TemplateOpener)) {
50825081 return true ;
@@ -5699,9 +5698,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
56995698 if (isAllmanBrace (Left) || isAllmanBrace (Right)) {
57005699 auto *FirstNonComment = Line.getFirstNonComment ();
57015700 bool AccessSpecifier =
5702- FirstNonComment &&
5703- FirstNonComment->isOneOf (Keywords.kw_internal , tok::kw_public,
5704- tok::kw_private, tok::kw_protected);
5701+ FirstNonComment && (FirstNonComment->is (Keywords.kw_internal ) ||
5702+ FirstNonComment->isAccessSpecifierKeyword ());
57055703
57065704 if (Style.BraceWrapping .AfterEnum ) {
57075705 if (Line.startsWith (tok::kw_enum) ||
@@ -5887,13 +5885,13 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
58875885 } else if (Style.isJavaScript ()) {
58885886 const FormatToken *NonComment = Right.getPreviousNonComment ();
58895887 if (NonComment &&
5890- NonComment->isOneOf (
5891- tok::kw_return, Keywords. kw_yield , tok::kw_continue, tok::kw_break,
5892- tok::kw_throw , Keywords.kw_interface , Keywords. kw_type ,
5893- tok::kw_static, tok::kw_public, tok::kw_private, tok::kw_protected ,
5894- Keywords. kw_readonly , Keywords.kw_override , Keywords.kw_abstract ,
5895- Keywords.kw_get , Keywords.kw_set , Keywords.kw_async ,
5896- Keywords.kw_await )) {
5888+ ( NonComment->isAccessSpecifierKeyword () ||
5889+ NonComment-> isOneOf (
5890+ tok::kw_return , Keywords.kw_yield , tok::kw_continue, tok::kw_break ,
5891+ tok::kw_throw, Keywords. kw_interface , Keywords. kw_type ,
5892+ tok::kw_static , Keywords.kw_readonly , Keywords.kw_override ,
5893+ Keywords.kw_abstract , Keywords.kw_get , Keywords.kw_set ,
5894+ Keywords.kw_async , Keywords. kw_await ) )) {
58975895 return false ; // Otherwise automatic semicolon insertion would trigger.
58985896 }
58995897 if (Right.NestingLevel == 0 &&
0 commit comments