MyDeveloperDay added a comment.


  bool FormatTokenLexer::tryMergeAtTry() {
    if (Tokens.size() < 2)
      return false;
    auto &At = *(Tokens.end() - 2);
    auto &Try = *(Tokens.end() - 1);
    if (!At->is(tok::at) || !String->is(tok::try))
      return false;
    At->Tok.setKind(tok::try);
    At->TokenText = StringRef(At->TokenText.begin(),
                              String->TokenText.end() - At->TokenText.begin());
    At->ColumnWidth += String->ColumnWidth;
    Tokens.erase(Tokens.end() - 1);
    return true;
  }
  
  bool FormatTokenLexer::tryMergeAtCatch() {
    if (Tokens.size() < 2)
      return false;
    auto &At = *(Tokens.end() - 2);
    auto &Try = *(Tokens.end() - 1);
    if (!At->is(tok::at) || !String->is(tok::catch))
      return false;
    At->Tok.setKind(tok::catch);
    At->TokenText = StringRef(At->TokenText.begin(),
                              String->TokenText.end() - At->TokenText.begin());
    At->ColumnWidth += String->ColumnWidth;
    Tokens.erase(Tokens.end() - 1);
    return true;
  }

I think adding these 2 functions could help to always treat @try and @catch the 
same as you we do `try` and `catch` (and any rules they have like `BeforeCatch` 
etc..

Did you consider doing that or are you not pursuing this patch any more?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71239



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to