================
@@ -862,8 +862,14 @@ 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 FileID LocFileID = SM.getFileID(Loc);
     if (Offset > 0 || !isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))
       return {}; // Points inside the macro expansion.
+    if (!SM.getSLocEntry(LocFileID).getExpansion().isExpansionTokenRange())
----------------
shafik wrote:

What happens if we move this outside of the `if(Loc.isMacroID)` check? Does it 
still work? Does it break other tests? I am not fully convinced this is the 
right location for the fix.

https://github.com/llvm/llvm-project/pull/184555
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to