================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits