[PATCH] D113319: [clang-format] Improve require and concept handling

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 13:48:47 PST 2022


curdeius added a comment.

In D113319#3338290 <https://reviews.llvm.org/D113319#3338290>, @HazardyKnusperkeks wrote:

> 



> That means someone guesses this is a binary op and guesses wrong. I try to take a look at it.

Yeah, I just found out that it is set in `determineStarAmpUsage` here:

  if (PrevToken->Tok.isLiteral() ||
      PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true,
                         tok::kw_false, tok::r_brace) ||
      NextToken->Tok.isLiteral() ||
      NextToken->isOneOf(tok::kw_true, tok::kw_false) ||
      NextToken->isUnaryOperator() ||
      // If we know we're in a template argument, there are no named
      // declarations. Thus, having an identifier on the right-hand side
      // indicates a binary operator.
      (InTemplateArgument && NextToken->Tok.isAnyIdentifier()))
    return TT_BinaryOperator;

Strangely, `InTemplateArgument` is true here, but not sure how that happens, as it wasn't something you changed directly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113319/new/

https://reviews.llvm.org/D113319



More information about the cfe-commits mailing list