[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 06:28:06 PST 2026
================
@@ -862,8 +862,17 @@ SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset,
return {};
if (Loc.isMacroID()) {
+ // Token-split expansion ranges (for example, when splitting '>>' into two
+ // '>' tokens while parsing templates) are character ranges, so the
+ // expansion end location already points just past the split token.
+ const bool IsTokenSplitRange =
+ !SM.getSLocEntry(SM.getFileID(Loc))
+ .getExpansion()
+ .isExpansionTokenRange();
if (Offset > 0 || !isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))
return {}; // Points inside the macro expansion.
+ if (IsTokenSplitRange)
----------------
luoliwoshang wrote:
Thanks for the suggestion — updated in 6567092cb.
https://github.com/llvm/llvm-project/pull/184555
More information about the cfe-commits
mailing list