From 1b791d6465d42a9763927be1dd8af229efcbbf5e Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 9 Feb 2011 21:08:21 +0000 Subject: [PATCH] Lexer: add CUDA kernel call tokens git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125218 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/TokenKinds.def | 4 ++++ lib/Lex/Lexer.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 5c21cd6ccd..cf917a95ce 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -176,6 +176,10 @@ PUNCTUATOR(coloncolon, "::") // Objective C support. PUNCTUATOR(at, "@") +// CUDA support. +PUNCTUATOR(lesslessless, "<<<") +PUNCTUATOR(greatergreatergreater, ">>>") + // C99 6.4.1: Keywords. These turn into kw_* tokens. // Flags allowed: // KEYALL - This is a keyword in all variants of C and C++, or it diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 7c94528c64..fd5bb617a0 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -2323,6 +2323,10 @@ LexNextToken: // If this is actually a '<<<<<<<' version control conflict marker, // recognize it as such and recover nicely. goto LexNextToken; + } else if (Features.CUDA && After == '<') { + Kind = tok::lesslessless; + CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), + SizeTmp2, Result); } else { CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::lessless; @@ -2354,6 +2358,10 @@ LexNextToken: } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { // If this is '>>>>>>>' and we're in a conflict marker, ignore it. goto LexNextToken; + } else if (Features.CUDA && After == '>') { + Kind = tok::greatergreatergreater; + CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), + SizeTmp2, Result); } else { CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::greatergreater; -- 2.40.0