[clang] [Clang] fix missing source location for ':' error in macro-expanded case statements (PR #143460)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 10 10:19:20 PDT 2025


efriedma-quic wrote:

I see two possible ways to approach this, in general:

- Come up with a method that actually figures out the end of the token inside the macro, instead of bailing on macros.  I'm not sure we can provide a good location in edge cases involving token pasting, but we can probably do better that just immediately bailing on any macro.
- Add a variant of getLocForEndOfToken that lets you pass in a fallback location.  The method would return that instead of an invalid token.  Here, you can probably just use `Tok.getLocation()`.

I think we normally suppress fixits in macros anyway, so you don't need to worry about places that pass the result of getLocForEndOfToken to a fixit.

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


More information about the cfe-commits mailing list