================ @@ -5072,7 +5072,38 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Left.endsSequence(tok::greatergreater, tok::l_brace))) { return false; } + } else if (Style.isTableGen()) { + // Avoid to connect [ and {. [{ is start token of multiline string. + if (Left.is(tok::l_square) && Right.is(tok::l_brace)) + return true; + if (Left.is(tok::r_brace) && Right.is(tok::r_square)) + return true; + // Do not insert around colon in DAGArg and cond operator. + if (Right.is(TT_TableGenDAGArgListColon) || + Left.is(TT_TableGenDAGArgListColon)) { + return false; + } + if (Right.is(TT_TableGenCondOperatorColon)) + return false; + // Do not insert bang operators and consequent openers. + if (Right.isOneOf(tok::l_paren, tok::less) && + Left.isOneOf(TT_TableGenBangOperator, TT_TableGenCondOperator)) { + return false; + } + // Trailing paste requires space before '{' or ':', the case in name values. + // Not before ';', the case in normal values. + if (Left.is(TT_TableGenTrailingPasteOperator) && + Right.isOneOf(tok::l_brace, tok::colon)) { + return true; + } + // Otherwise paste operator does not prefer space around. + if (Left.is(tok::hash) || Right.is(tok::hash)) + return false; + // Sure not to connect after defining keywords. + if (Keywords.isTableGenDefinition(Left)) + return true; ---------------- hnakamura5 wrote:
Returning true forces to insert space between Left and Right tokens. https://github.com/llvm/llvm-project/pull/81611 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits