[clang] [clang-format] Support of TableGen value annotations. (PR #80299)

Hirofumi Nakamura via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 07:15:18 PST 2024


================
@@ -549,6 +583,22 @@ class AnnotatingParser {
       if (CurrentToken->is(tok::comma))
         Contexts.back().CanBeExpression = true;
 
+      if (Style.isTableGen()) {
+        if (CurrentToken->is(tok::comma)) {
+          if (Contexts.back().IsTableGenCondOpe)
+            CurrentToken->setType(TT_TableGenCondOperatorComma);
+          next();
+        } else if (CurrentToken->is(tok::colon)) {
+          if (Contexts.back().IsTableGenCondOpe)
+            CurrentToken->setType(TT_TableGenCondOperatorColon);
+          next();
+        }
+        // In TableGen there must be Values in parens.
+        if (!parseTableGenValue())
+          return false;
+        continue;
+      }
+
----------------
hnakamura5 wrote:

In parseParens().

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


More information about the cfe-commits mailing list