[clang] [clang-format] Support of TableGen value annotations. (PR #80299)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 5 12:22:08 PST 2024
================
@@ -1423,11 +1692,30 @@ class AnnotatingParser {
if (!Tok->getPreviousNonComment())
Line.IsContinuation = true;
}
+ if (Style.isTableGen()) {
+ if (Tok->is(Keywords.kw_assert)) {
+ if (!parseTableGenValue())
+ return false;
+ } else if (Tok->isOneOf(Keywords.kw_def, Keywords.kw_defm) &&
+ (!Tok->Next ||
+ !Tok->Next->isOneOf(tok::colon, tok::l_brace))) {
+ // The case NameValue appears.
+ if (!parseTableGenValue(true))
+ return false;
+ }
+ }
break;
case tok::arrow:
if (Tok->Previous && Tok->Previous->is(tok::kw_noexcept))
Tok->setType(TT_TrailingReturnArrow);
break;
+ case tok::equal:
+ // In TableGen, there must be a value after "=";
+ if (Style.isTableGen()) {
+ if (!parseTableGenValue())
----------------
HazardyKnusperkeks wrote:
```suggestion
if (Style.isTableGen() && !parseTableGenValue())
```
https://github.com/llvm/llvm-project/pull/80299
More information about the cfe-commits
mailing list