@@ -127,7 +127,7 @@ class AnnotatingParser {
127
127
SmallVector<ScopeType> &Scopes)
128
128
: Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false ),
129
129
IsCpp (Style.isCpp()), LangOpts(getFormattingLangOpts(Style)),
130
- Keywords(Keywords), Scopes(Scopes), TemplateDeclarationDepth( 0 ) {
130
+ Keywords(Keywords), Scopes(Scopes) {
131
131
assert (IsCpp == LangOpts.CXXOperatorNames );
132
132
Contexts.push_back (Context (tok::unknown, 1 , /* IsExpression=*/ false ));
133
133
resetTokenMetadata ();
@@ -1266,22 +1266,16 @@ class AnnotatingParser {
1266
1266
}
1267
1267
1268
1268
bool parseTemplateDeclaration () {
1269
- if (!CurrentToken || CurrentToken->isNot (tok::less))
1270
- return false ;
1271
-
1272
- CurrentToken->setType (TT_TemplateOpener);
1273
- next ();
1274
-
1275
- TemplateDeclarationDepth++;
1276
- const bool WellFormed = parseAngle ();
1277
- TemplateDeclarationDepth--;
1278
- if (!WellFormed)
1279
- return false ;
1280
-
1281
- if (CurrentToken && TemplateDeclarationDepth == 0 )
1282
- CurrentToken->Previous ->ClosesTemplateDeclaration = true ;
1283
-
1284
- return true ;
1269
+ if (CurrentToken && CurrentToken->is (tok::less)) {
1270
+ CurrentToken->setType (TT_TemplateOpener);
1271
+ next ();
1272
+ if (!parseAngle ())
1273
+ return false ;
1274
+ if (CurrentToken)
1275
+ CurrentToken->Previous ->ClosesTemplateDeclaration = true ;
1276
+ return true ;
1277
+ }
1278
+ return false ;
1285
1279
}
1286
1280
1287
1281
bool consumeToken () {
@@ -3097,8 +3091,6 @@ class AnnotatingParser {
3097
3091
// same decision irrespective of the decisions for tokens leading up to it.
3098
3092
// Store this information to prevent this from causing exponential runtime.
3099
3093
llvm::SmallPtrSet<FormatToken *, 16 > NonTemplateLess;
3100
-
3101
- int TemplateDeclarationDepth;
3102
3094
};
3103
3095
3104
3096
static const int PrecedenceUnaryOperator = prec::PointerToMember + 1 ;
0 commit comments