[clang] Disable -fdollars-in-identifiers by default (PR #135407)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 16 05:30:37 PDT 2025


AaronBallman wrote:

> If you don't want to do anything fancy, can you just add a warning in Lexer::LexTokenInternal if we see a '$' (where we set the token type to tok::unknown)? That should be easy to implement, and have zero impact on lexer performance.

Okay, that's pretty reasonable. Note, we only emit the diagnostic when finding `$` at the *start* of an identifier, not as a continuation character. Otherwise we'd issue two diagnostics for `foo$bar`, one for finding the continuation character and one for finding the start of the next token. I added test coverage to be sure we caught `$a`, `a$`, and `a$b` correctly.

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


More information about the cfe-commits mailing list