[clang] [clang-format] Don't case-fix numeric literals in macro invocations (PR #212328)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 19 02:06:00 PDT 2026


HazardyKnusperkeks wrote:

I had the hope that the `Macro` logic would prevent the case changing. But I think the real problem is, that we use the raw lexer here. `16header` is completely lexed as `numeric_literal` which is wrong in the first place.
Your proposed solution would tackle one case of the problems, but not the include, and also not `#define ohNo(X) x ## 12hex`. But also the `WhitespaceSensitiveMacros` is the wrong option, it's not about whitespace here. I think we need to fully lex and possible parse in the `NumericLiteralFixer` or add a lot more logic to check if a token is actually a valid numeric literal and check its surroundings.

Any input @owenca ?

https://github.com/llvm/llvm-project/pull/212328


More information about the cfe-commits mailing list