[clang] [clang][CUDA/HIP] Fix parsing of `operator<<<...>` (PR #218384)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 25 04:16:38 PDT 2026
================
@@ -2485,6 +2485,30 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext,
Actions.CodeCompletion().CodeCompleteOperatorName(getCurScope());
return true;
}
+ case tok::lesslessless: {
+ // For CUDA, the Lexer will greedily merge all three <<< in operator<<<
+ // which, in fact, can be a valid template specialization of operator<<,
+ // and will never be a valid kernel launch expression, so split.
+ bool CachingTokens = PP.IsPreviousCachedToken(Tok);
+ // If there was a cache, we should update it when doing token split.
+ // The code below never does.
+ assert(!CachingTokens && "No cache expected");
----------------
Fznamznon wrote:
Added the test, thank you.
https://github.com/llvm/llvm-project/pull/218384
More information about the cfe-commits
mailing list