[clang] [clang] Fix alias declaration fix-it location for token-split '>>' (PR #184555)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 4 05:56:47 PST 2026
================
@@ -862,8 +862,17 @@ SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset,
return {};
if (Loc.isMacroID()) {
----------------
luoliwoshang wrote:
Thanks for the question. The reason this is in the `isMacroID()` branch is that `isMacroID()` only checks `MacroIDBit`; it does not distinguish how that bit was produced.
In this testcase there is no user macro, but `>>` is split during template parsing via `PP.SplitToken`. After that, the location goes through `createTokenSplitLoc -> createExpansionLocImpl -> getMacroLoc`, so the location carries `MacroIDBit` and naturally enters the `isMacroID()` path.
https://github.com/llvm/llvm-project/pull/184555
More information about the cfe-commits
mailing list