[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

Emilia Kond via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 22 02:36:18 PDT 2024


================
@@ -1269,10 +1269,17 @@ class AnnotatingParser {
     if (CurrentToken && CurrentToken->is(tok::less)) {
       CurrentToken->setType(TT_TemplateOpener);
       next();
-      if (!parseAngle())
+      TemplateDeclarationDepth++;
+      if (!parseAngle()) {
+        TemplateDeclarationDepth--;
         return false;
-      if (CurrentToken)
+      }
+      TemplateDeclarationDepth--;
+      if (CurrentToken &&
+          (TemplateDeclarationDepth == 0 ||
+           !CurrentToken->isOneOf(tok::kw_typename, tok::kw_class))) {
----------------
rymiel wrote:

Thanks!

https://github.com/llvm/llvm-project/pull/95025


More information about the cfe-commits mailing list