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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 14 05:25:00 PDT 2025


AaronBallman wrote:

> If we're going to do this, I think we need better diagnostics. Just straight disabling this is going to give very confusing diagnostics to anyone actually using dollar-signs in identifiers.
> 
> Some ideas:
> 
>     * We can give a warning if we see a "$" adjacent to an identifier without any whitespace separating it.
> 
>     * Outside the preprocessor, we can parse a "$" adjacent to an identifier as part of the identifier, with some sort of diagnostic, since it's guaranteed to be an error anyway.

My concern here is with regressing performance of the lexer; testing those conditions when lexing *any* identifier seems like we'd be spending a lot of time trying to catch a very uncommon issue.

I think this is reasonable as follow-up work, but I don't think it should hold up this PR because this is fixing a conformance issue. (FWIW, I think the behavior you get currently is something we could live with even if that follow-up work never happened.)

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


More information about the cfe-commits mailing list