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

Emilia Dreamer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 2 01:58:09 PDT 2022


rymiel added a comment.

> The operator `""` and the identifier that follows should be two separate tokens regardless if the identifier starts with an underscore.

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)

https://github.com/llvm/llvm-project/blob/6f46ff3765dcdc178b9cf52ebd8c03437806798a/clang/lib/Lex/Lexer.cpp#L1960-L1975
https://github.com/llvm/llvm-project/blob/3f18f7c0072b642f5fe88d2fb7bb8ccf69a6c6f5/clang/lib/Lex/LiteralSupport.cpp#L1180-L1185

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


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