[cfe-commits] r125218 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Lex/Lexer.cpp
Peter Collingbourne
peter at pcc.me.uk
Wed Feb 9 13:08:22 PST 2011
Author: pcc
Date: Wed Feb 9 15:08:21 2011
New Revision: 125218
URL: http://llvm.org/viewvc/llvm-project?rev=125218&view=rev
Log:
Lexer: add CUDA kernel call tokens
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/lib/Lex/Lexer.cpp
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=125218&r1=125217&r2=125218&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Wed Feb 9 15:08:21 2011
@@ -176,6 +176,10 @@
// 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
Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=125218&r1=125217&r2=125218&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Wed Feb 9 15:08:21 2011
@@ -2323,6 +2323,10 @@
// 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 @@
} 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;
More information about the cfe-commits
mailing list