[PATCH] D134853: [clang-format] Correctly annotate UDLs as OverloadedOperator

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 2 12:49:20 PDT 2022


owenpan added a comment.

In D134853#3829433 <https://reviews.llvm.org/D134853#3829433>, @rymiel wrote:

> So, after some investigation, it turns out the clang lexer only combines an underscore-less UDL to a single `string_literal` token if it's a valid standard library UDL (in the given standard library version)

And only if there are no spaces between `""` and the identifier. Otherwise, it's invalid. See https://en.cppreference.com/w/cpp/language/user_literal.

> Which means only single-token `string_literal`s should be considered

We don't want to merge e.g. `"" _foo` or `"" if` into a single token `""_foo` or `""if`. With the former, the user may want clang-format to keep the space. With the latter, I'm not sure if it's ok for clang-format to fix the syntax error.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134853



More information about the cfe-commits mailing list