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

Reply via email to