[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:14:59 PST 2024
================
@@ -388,6 +400,28 @@ class AnnotatingParser {
Contexts.back().IsExpression = !IsForOrCatch;
}
+ if (Style.isTableGen()) {
+ if (FormatToken *Prev = OpeningParen.Previous) {
+ if (Prev->is(TT_TableGenCondOperator)) {
+ Contexts.back().IsTableGenCondOpe = true;
+ Contexts.back().IsExpression = true;
+ } else if (Contexts.size() > 1 &&
+ Contexts[Contexts.size() - 2].IsTableGenBangOpe) {
+ // Hack to handle bang operators. The parent context's flag
+ // was set by parseTableGenSimpleValue().
+ // We have to specify the context outside because the prev of "(" may
+ // be ">", not the bang operator in this case.
+ Contexts.back().IsTableGenBangOpe = true;
+ Contexts.back().IsExpression = true;
+ } else {
+ // Otherwise, this paren seems DAGArg.
+ if (!parseTableGenDAGArg())
+ return false;
+ return parseTableGenDAGArgAndList(&OpeningParen);
+ }
+ }
+ }
+
----------------
hnakamura5 wrote:
In parseParens().
https://github.com/llvm/llvm-project/pull/80299
More information about the cfe-commits
mailing list