@@ -263,8 +263,7 @@ class AnnotatingParser {
263263 Previous->setType (TT_SelectorName);
264264 }
265265 }
266- }
267- if (Style.isTableGen ()) {
266+ } else if (Style.isTableGen ()) {
268267 if (CurrentToken->isOneOf (tok::comma, tok::equal)) {
269268 // They appear as separators. Unless they are not in class definition.
270269 next ();
@@ -3016,12 +3015,13 @@ class AnnotatingParser {
30163015 return TT_BinaryOperator;
30173016
30183017 const FormatToken *NextToken = Tok.getNextNonComment ();
3018+ if (!NextToken)
3019+ return TT_PointerOrReference;
30193020
3020- if (InTemplateArgument && NextToken && NextToken ->is (tok::kw_noexcept))
3021+ if (InTemplateArgument && NextToken->is (tok::kw_noexcept))
30213022 return TT_BinaryOperator;
30223023
3023- if (!NextToken ||
3024- NextToken->isOneOf (tok::arrow, tok::equal, tok::comma, tok::r_paren,
3024+ if (NextToken->isOneOf (tok::arrow, tok::equal, tok::comma, tok::r_paren,
30253025 TT_RequiresClause) ||
30263026 (NextToken->is (tok::kw_noexcept) && !IsExpression) ||
30273027 NextToken->canBePointerOrReferenceQualifier () ||
@@ -6519,18 +6519,8 @@ TokenAnnotator::getTokenReferenceAlignment(const FormatToken &Reference) const {
65196519FormatStyle::PointerAlignmentStyle
65206520TokenAnnotator::getTokenPointerOrReferenceAlignment (
65216521 const FormatToken &PointerOrReference) const {
6522- if (PointerOrReference.isOneOf (tok::amp, tok::ampamp)) {
6523- switch (Style.ReferenceAlignment ) {
6524- case FormatStyle::RAS_Pointer:
6525- return Style.PointerAlignment ;
6526- case FormatStyle::RAS_Left:
6527- return FormatStyle::PAS_Left;
6528- case FormatStyle::RAS_Right:
6529- return FormatStyle::PAS_Right;
6530- case FormatStyle::RAS_Middle:
6531- return FormatStyle::PAS_Middle;
6532- }
6533- }
6522+ if (PointerOrReference.isOneOf (tok::amp, tok::ampamp))
6523+ return getTokenReferenceAlignment (PointerOrReference);
65346524 assert (PointerOrReference.is (tok::star));
65356525 return Style.PointerAlignment ;
65366526}
0 commit comments