[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 25 04:43:00 PDT 2025


Sirraide wrote:

> But the token kind we have is `identifier` and not one of the keywords, so we can't do the more trivial integer comparisons.

Can we precompute a list/map/whatever of all identifiers that are keywords in C++ but not in C and then do pointer comparisons on the `IdentifierInfo*` maybe? At least then we wouldn’t have to do actual string comparisons; that said, I’m not sure that’s going to be that much better...

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


More information about the cfe-commits mailing list