1//===--- TokenKinds.def - C Family Token Kind Database ----------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the TokenKind database.  This includes normal tokens like
11// tok::ampamp (corresponding to the && token) as well as keywords for various
12// languages.  Users of this file must optionally #define the TOK, KEYWORD,
13// ALIAS, or PPKEYWORD macros to make use of this file.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef TOK
18#define TOK(X)
19#endif
20#ifndef PUNCTUATOR
21#define PUNCTUATOR(X,Y) TOK(X)
22#endif
23#ifndef KEYWORD
24#define KEYWORD(X,Y) TOK(kw_ ## X)
25#endif
26#ifndef TYPE_TRAIT
27#define TYPE_TRAIT(N,I,K) KEYWORD(I,K)
28#endif
29#ifndef TYPE_TRAIT_1
30#define TYPE_TRAIT_1(I,E,K) TYPE_TRAIT(1,I,K)
31#endif
32#ifndef TYPE_TRAIT_2
33#define TYPE_TRAIT_2(I,E,K) TYPE_TRAIT(2,I,K)
34#endif
35#ifndef TYPE_TRAIT_N
36#define TYPE_TRAIT_N(I,E,K) TYPE_TRAIT(0,I,K)
37#endif
38#ifndef ALIAS
39#define ALIAS(X,Y,Z)
40#endif
41#ifndef PPKEYWORD
42#define PPKEYWORD(X)
43#endif
44#ifndef CXX_KEYWORD_OPERATOR
45#define CXX_KEYWORD_OPERATOR(X,Y)
46#endif
47#ifndef OBJC1_AT_KEYWORD
48#define OBJC1_AT_KEYWORD(X)
49#endif
50#ifndef OBJC2_AT_KEYWORD
51#define OBJC2_AT_KEYWORD(X)
52#endif
53#ifndef TESTING_KEYWORD
54#define TESTING_KEYWORD(X, L) KEYWORD(X, L)
55#endif
56#ifndef ANNOTATION
57#define ANNOTATION(X) TOK(annot_ ## X)
58#endif
59
60//===----------------------------------------------------------------------===//
61// Preprocessor keywords.
62//===----------------------------------------------------------------------===//
63
64// These have meaning after a '#' at the start of a line. These define enums in
65// the tok::pp_* namespace.  Note that IdentifierInfo::getPPKeywordID must be
66// manually updated if something is added here.
67PPKEYWORD(not_keyword)
68
69// C99 6.10.1 - Conditional Inclusion.
70PPKEYWORD(if)
71PPKEYWORD(ifdef)
72PPKEYWORD(ifndef)
73PPKEYWORD(elif)
74PPKEYWORD(else)
75PPKEYWORD(endif)
76PPKEYWORD(defined)
77
78// C99 6.10.2 - Source File Inclusion.
79PPKEYWORD(include)
80PPKEYWORD(__include_macros)
81
82// C99 6.10.3 - Macro Replacement.
83PPKEYWORD(define)
84PPKEYWORD(undef)
85
86// C99 6.10.4 - Line Control.
87PPKEYWORD(line)
88
89// C99 6.10.5 - Error Directive.
90PPKEYWORD(error)
91
92// C99 6.10.6 - Pragma Directive.
93PPKEYWORD(pragma)
94
95// GNU Extensions.
96PPKEYWORD(import)
97PPKEYWORD(include_next)
98PPKEYWORD(warning)
99PPKEYWORD(ident)
100PPKEYWORD(sccs)
101PPKEYWORD(assert)
102PPKEYWORD(unassert)
103
104// Clang extensions
105PPKEYWORD(__public_macro)
106PPKEYWORD(__private_macro)
107
108//===----------------------------------------------------------------------===//
109// Language keywords.
110//===----------------------------------------------------------------------===//
111
112// These define members of the tok::* namespace.
113
114TOK(unknown)             // Not a token.
115TOK(eof)                 // End of file.
116TOK(eod)                 // End of preprocessing directive (end of line inside a
117                         // directive).
118TOK(code_completion)     // Code completion marker
119
120// C99 6.4.9: Comments.
121TOK(comment)             // Comment (only in -E -C[C] mode)
122
123// C99 6.4.2: Identifiers.
124TOK(identifier)          // abcde123
125TOK(raw_identifier)      // Used only in raw lexing mode.
126
127// C99 6.4.4.1: Integer Constants
128// C99 6.4.4.2: Floating Constants
129TOK(numeric_constant)    // 0x123
130
131// C99 6.4.4: Character Constants
132TOK(char_constant)       // 'a'
133TOK(wide_char_constant)  // L'b'
134
135// C++1z Character Constants
136TOK(utf8_char_constant)  // u8'a'
137
138// C++11 Character Constants
139TOK(utf16_char_constant) // u'a'
140TOK(utf32_char_constant) // U'a'
141
142// C99 6.4.5: String Literals.
143TOK(string_literal)      // "foo"
144TOK(wide_string_literal) // L"foo"
145TOK(angle_string_literal)// <foo>
146
147// C++11 String Literals.
148TOK(utf8_string_literal) // u8"foo"
149TOK(utf16_string_literal)// u"foo"
150TOK(utf32_string_literal)// U"foo"
151
152// C99 6.4.6: Punctuators.
153PUNCTUATOR(l_square,            "[")
154PUNCTUATOR(r_square,            "]")
155PUNCTUATOR(l_paren,             "(")
156PUNCTUATOR(r_paren,             ")")
157PUNCTUATOR(l_brace,             "{")
158PUNCTUATOR(r_brace,             "}")
159PUNCTUATOR(period,              ".")
160PUNCTUATOR(ellipsis,            "...")
161PUNCTUATOR(amp,                 "&")
162PUNCTUATOR(ampamp,              "&&")
163PUNCTUATOR(ampequal,            "&=")
164PUNCTUATOR(star,                "*")
165PUNCTUATOR(starequal,           "*=")
166PUNCTUATOR(plus,                "+")
167PUNCTUATOR(plusplus,            "++")
168PUNCTUATOR(plusequal,           "+=")
169PUNCTUATOR(minus,               "-")
170PUNCTUATOR(arrow,               "->")
171PUNCTUATOR(minusminus,          "--")
172PUNCTUATOR(minusequal,          "-=")
173PUNCTUATOR(tilde,               "~")
174PUNCTUATOR(exclaim,             "!")
175PUNCTUATOR(exclaimequal,        "!=")
176PUNCTUATOR(slash,               "/")
177PUNCTUATOR(slashequal,          "/=")
178PUNCTUATOR(percent,             "%")
179PUNCTUATOR(percentequal,        "%=")
180PUNCTUATOR(less,                "<")
181PUNCTUATOR(lessless,            "<<")
182PUNCTUATOR(lessequal,           "<=")
183PUNCTUATOR(lesslessequal,       "<<=")
184PUNCTUATOR(greater,             ">")
185PUNCTUATOR(greatergreater,      ">>")
186PUNCTUATOR(greaterequal,        ">=")
187PUNCTUATOR(greatergreaterequal, ">>=")
188PUNCTUATOR(caret,               "^")
189PUNCTUATOR(caretequal,          "^=")
190PUNCTUATOR(pipe,                "|")
191PUNCTUATOR(pipepipe,            "||")
192PUNCTUATOR(pipeequal,           "|=")
193PUNCTUATOR(question,            "?")
194PUNCTUATOR(colon,               ":")
195PUNCTUATOR(semi,                ";")
196PUNCTUATOR(equal,               "=")
197PUNCTUATOR(equalequal,          "==")
198PUNCTUATOR(comma,               ",")
199PUNCTUATOR(hash,                "#")
200PUNCTUATOR(hashhash,            "##")
201PUNCTUATOR(hashat,              "#@")
202
203// C++ Support
204PUNCTUATOR(periodstar,          ".*")
205PUNCTUATOR(arrowstar,           "->*")
206PUNCTUATOR(coloncolon,          "::")
207
208// Objective C support.
209PUNCTUATOR(at,                  "@")
210
211// CUDA support.
212PUNCTUATOR(lesslessless,          "<<<")
213PUNCTUATOR(greatergreatergreater, ">>>")
214
215// C99 6.4.1: Keywords.  These turn into kw_* tokens.
216// Flags allowed:
217//   KEYALL   - This is a keyword in all variants of C and C++, or it
218//              is a keyword in the implementation namespace that should
219//              always be treated as a keyword
220//   KEYC99   - This is a keyword introduced to C in C99
221//   KEYC11   - This is a keyword introduced to C in C11
222//   KEYCXX   - This is a C++ keyword, or a C++-specific keyword in the
223//              implementation namespace
224//   KEYNOCXX - This is a keyword in every non-C++ dialect.
225//   KEYCXX11 - This is a C++ keyword introduced to C++ in C++11
226//   KEYGNU   - This is a keyword if GNU extensions are enabled
227//   KEYMS    - This is a keyword if Microsoft extensions are enabled
228//   KEYNOMS18 - This is a keyword that must never be enabled under
229//               MSVC <= v18.
230//   KEYOPENCL  - This is a keyword in OpenCL
231//   KEYNOOPENCL  - This is a keyword that is not supported in OpenCL
232//   KEYALTIVEC - This is a keyword in AltiVec
233//   KEYBORLAND - This is a keyword if Borland extensions are enabled
234//   BOOLSUPPORT - This is a keyword if 'bool' is a built-in type
235//   HALFSUPPORT - This is a keyword if 'half' is a built-in type
236//   WCHARSUPPORT - This is a keyword if 'wchar_t' is a built-in type
237//
238KEYWORD(auto                        , KEYALL)
239KEYWORD(break                       , KEYALL)
240KEYWORD(case                        , KEYALL)
241KEYWORD(char                        , KEYALL)
242KEYWORD(const                       , KEYALL)
243KEYWORD(continue                    , KEYALL)
244KEYWORD(default                     , KEYALL)
245KEYWORD(do                          , KEYALL)
246KEYWORD(double                      , KEYALL)
247KEYWORD(else                        , KEYALL)
248KEYWORD(enum                        , KEYALL)
249KEYWORD(extern                      , KEYALL)
250KEYWORD(float                       , KEYALL)
251KEYWORD(for                         , KEYALL)
252KEYWORD(goto                        , KEYALL)
253KEYWORD(if                          , KEYALL)
254KEYWORD(inline                      , KEYC99|KEYCXX|KEYGNU)
255KEYWORD(int                         , KEYALL)
256KEYWORD(long                        , KEYALL)
257KEYWORD(register                    , KEYALL)
258KEYWORD(restrict                    , KEYC99)
259KEYWORD(return                      , KEYALL)
260KEYWORD(short                       , KEYALL)
261KEYWORD(signed                      , KEYALL)
262KEYWORD(sizeof                      , KEYALL)
263KEYWORD(static                      , KEYALL)
264KEYWORD(struct                      , KEYALL)
265KEYWORD(switch                      , KEYALL)
266KEYWORD(typedef                     , KEYALL)
267KEYWORD(union                       , KEYALL)
268KEYWORD(unsigned                    , KEYALL)
269KEYWORD(void                        , KEYALL)
270KEYWORD(volatile                    , KEYALL)
271KEYWORD(while                       , KEYALL)
272KEYWORD(_Alignas                    , KEYALL)
273KEYWORD(_Alignof                    , KEYALL)
274KEYWORD(_Atomic                     , KEYALL|KEYNOMS18|KEYNOOPENCL)
275KEYWORD(_Bool                       , KEYNOCXX)
276KEYWORD(_Complex                    , KEYALL)
277KEYWORD(_Generic                    , KEYALL)
278KEYWORD(_Imaginary                  , KEYALL)
279KEYWORD(_Noreturn                   , KEYALL)
280KEYWORD(_Static_assert              , KEYALL)
281KEYWORD(_Thread_local               , KEYALL)
282KEYWORD(__func__                    , KEYALL)
283KEYWORD(__objc_yes                  , KEYALL)
284KEYWORD(__objc_no                   , KEYALL)
285
286
287// C++ 2.11p1: Keywords.
288KEYWORD(asm                         , KEYCXX|KEYGNU)
289KEYWORD(bool                        , BOOLSUPPORT)
290KEYWORD(catch                       , KEYCXX)
291KEYWORD(class                       , KEYCXX)
292KEYWORD(const_cast                  , KEYCXX)
293KEYWORD(delete                      , KEYCXX)
294KEYWORD(dynamic_cast                , KEYCXX)
295KEYWORD(explicit                    , KEYCXX)
296KEYWORD(export                      , KEYCXX)
297KEYWORD(false                       , BOOLSUPPORT)
298KEYWORD(friend                      , KEYCXX)
299KEYWORD(mutable                     , KEYCXX)
300KEYWORD(namespace                   , KEYCXX)
301KEYWORD(new                         , KEYCXX)
302KEYWORD(operator                    , KEYCXX)
303KEYWORD(private                     , KEYCXX)
304KEYWORD(protected                   , KEYCXX)
305KEYWORD(public                      , KEYCXX)
306KEYWORD(reinterpret_cast            , KEYCXX)
307KEYWORD(static_cast                 , KEYCXX)
308KEYWORD(template                    , KEYCXX)
309KEYWORD(this                        , KEYCXX)
310KEYWORD(throw                       , KEYCXX)
311KEYWORD(true                        , BOOLSUPPORT)
312KEYWORD(try                         , KEYCXX)
313KEYWORD(typename                    , KEYCXX)
314KEYWORD(typeid                      , KEYCXX)
315KEYWORD(using                       , KEYCXX)
316KEYWORD(virtual                     , KEYCXX)
317KEYWORD(wchar_t                     , WCHARSUPPORT)
318
319// C++ 2.5p2: Alternative Representations.
320CXX_KEYWORD_OPERATOR(and     , ampamp)
321CXX_KEYWORD_OPERATOR(and_eq  , ampequal)
322CXX_KEYWORD_OPERATOR(bitand  , amp)
323CXX_KEYWORD_OPERATOR(bitor   , pipe)
324CXX_KEYWORD_OPERATOR(compl   , tilde)
325CXX_KEYWORD_OPERATOR(not     , exclaim)
326CXX_KEYWORD_OPERATOR(not_eq  , exclaimequal)
327CXX_KEYWORD_OPERATOR(or      , pipepipe)
328CXX_KEYWORD_OPERATOR(or_eq   , pipeequal)
329CXX_KEYWORD_OPERATOR(xor     , caret)
330CXX_KEYWORD_OPERATOR(xor_eq  , caretequal)
331
332// C++11 keywords
333KEYWORD(alignas                     , KEYCXX11)
334KEYWORD(alignof                     , KEYCXX11)
335KEYWORD(char16_t                    , KEYCXX11|KEYNOMS18)
336KEYWORD(char32_t                    , KEYCXX11|KEYNOMS18)
337KEYWORD(constexpr                   , KEYCXX11)
338KEYWORD(decltype                    , KEYCXX11)
339KEYWORD(noexcept                    , KEYCXX11)
340KEYWORD(nullptr                     , KEYCXX11)
341KEYWORD(static_assert               , KEYCXX11)
342KEYWORD(thread_local                , KEYCXX11)
343
344// GNU Extensions (in impl-reserved namespace)
345KEYWORD(_Decimal32                  , KEYALL)
346KEYWORD(_Decimal64                  , KEYALL)
347KEYWORD(_Decimal128                 , KEYALL)
348KEYWORD(__null                      , KEYCXX)
349KEYWORD(__alignof                   , KEYALL)
350KEYWORD(__attribute                 , KEYALL)
351KEYWORD(__builtin_choose_expr       , KEYALL)
352KEYWORD(__builtin_offsetof          , KEYALL)
353// __builtin_types_compatible_p is a GNU C extension that we handle like a C++
354// type trait.
355TYPE_TRAIT_2(__builtin_types_compatible_p, TypeCompatible, KEYNOCXX)
356KEYWORD(__builtin_va_arg            , KEYALL)
357KEYWORD(__extension__               , KEYALL)
358KEYWORD(__imag                      , KEYALL)
359KEYWORD(__int128                    , KEYALL)
360KEYWORD(__label__                   , KEYALL)
361KEYWORD(__real                      , KEYALL)
362KEYWORD(__thread                    , KEYALL)
363KEYWORD(__FUNCTION__                , KEYALL)
364KEYWORD(__PRETTY_FUNCTION__         , KEYALL)
365
366// GNU Extensions (outside impl-reserved namespace)
367KEYWORD(typeof                      , KEYGNU)
368
369// MS Extensions
370KEYWORD(__FUNCDNAME__               , KEYMS)
371KEYWORD(__FUNCSIG__                 , KEYMS)
372KEYWORD(L__FUNCTION__               , KEYMS)
373TYPE_TRAIT_1(__is_interface_class, IsInterfaceClass, KEYMS)
374TYPE_TRAIT_1(__is_sealed, IsSealed, KEYMS)
375
376// MSVC12.0 / VS2013 Type Traits
377TYPE_TRAIT_1(__is_destructible, IsDestructible, KEYMS)
378TYPE_TRAIT_1(__is_nothrow_destructible, IsNothrowDestructible, KEYMS)
379TYPE_TRAIT_2(__is_nothrow_assignable, IsNothrowAssignable, KEYCXX)
380TYPE_TRAIT_N(__is_constructible, IsConstructible, KEYCXX)
381TYPE_TRAIT_N(__is_nothrow_constructible, IsNothrowConstructible, KEYCXX)
382
383// GNU and MS Type Traits
384TYPE_TRAIT_1(__has_nothrow_assign, HasNothrowAssign, KEYCXX)
385TYPE_TRAIT_1(__has_nothrow_move_assign, HasNothrowMoveAssign, KEYCXX)
386TYPE_TRAIT_1(__has_nothrow_copy, HasNothrowCopy, KEYCXX)
387TYPE_TRAIT_1(__has_nothrow_constructor, HasNothrowConstructor, KEYCXX)
388TYPE_TRAIT_1(__has_trivial_assign, HasTrivialAssign, KEYCXX)
389TYPE_TRAIT_1(__has_trivial_move_assign, HasTrivialMoveAssign, KEYCXX)
390TYPE_TRAIT_1(__has_trivial_copy, HasTrivialCopy, KEYCXX)
391TYPE_TRAIT_1(__has_trivial_constructor, HasTrivialDefaultConstructor, KEYCXX)
392TYPE_TRAIT_1(__has_trivial_move_constructor, HasTrivialMoveConstructor, KEYCXX)
393TYPE_TRAIT_1(__has_trivial_destructor, HasTrivialDestructor, KEYCXX)
394TYPE_TRAIT_1(__has_virtual_destructor, HasVirtualDestructor, KEYCXX)
395TYPE_TRAIT_1(__is_abstract, IsAbstract, KEYCXX)
396TYPE_TRAIT_2(__is_base_of, IsBaseOf, KEYCXX)
397TYPE_TRAIT_1(__is_class, IsClass, KEYCXX)
398TYPE_TRAIT_2(__is_convertible_to, IsConvertibleTo, KEYCXX)
399TYPE_TRAIT_1(__is_empty, IsEmpty, KEYCXX)
400TYPE_TRAIT_1(__is_enum, IsEnum, KEYCXX)
401TYPE_TRAIT_1(__is_final, IsFinal, KEYCXX)
402// Tentative name - there's no implementation of std::is_literal_type yet.
403TYPE_TRAIT_1(__is_literal, IsLiteral, KEYCXX)
404// Name for GCC 4.6 compatibility - people have already written libraries using
405// this name unfortunately.
406ALIAS("__is_literal_type", __is_literal, KEYCXX)
407TYPE_TRAIT_1(__is_pod, IsPOD, KEYCXX)
408TYPE_TRAIT_1(__is_polymorphic, IsPolymorphic, KEYCXX)
409TYPE_TRAIT_1(__is_trivial, IsTrivial, KEYCXX)
410TYPE_TRAIT_1(__is_union, IsUnion, KEYCXX)
411
412// Clang-only C++ Type Traits
413TYPE_TRAIT_N(__is_trivially_constructible, IsTriviallyConstructible, KEYCXX)
414TYPE_TRAIT_1(__is_trivially_copyable, IsTriviallyCopyable, KEYCXX)
415TYPE_TRAIT_2(__is_trivially_assignable, IsTriviallyAssignable, KEYCXX)
416KEYWORD(__underlying_type           , KEYCXX)
417
418// Embarcadero Expression Traits
419KEYWORD(__is_lvalue_expr            , KEYCXX)
420KEYWORD(__is_rvalue_expr            , KEYCXX)
421
422// Embarcadero Unary Type Traits
423TYPE_TRAIT_1(__is_arithmetic, IsArithmetic, KEYCXX)
424TYPE_TRAIT_1(__is_floating_point, IsFloatingPoint, KEYCXX)
425TYPE_TRAIT_1(__is_integral, IsIntegral, KEYCXX)
426TYPE_TRAIT_1(__is_complete_type, IsCompleteType, KEYCXX)
427TYPE_TRAIT_1(__is_void, IsVoid, KEYCXX)
428TYPE_TRAIT_1(__is_array, IsArray, KEYCXX)
429TYPE_TRAIT_1(__is_function, IsFunction, KEYCXX)
430TYPE_TRAIT_1(__is_reference, IsReference, KEYCXX)
431TYPE_TRAIT_1(__is_lvalue_reference, IsLvalueReference, KEYCXX)
432TYPE_TRAIT_1(__is_rvalue_reference, IsRvalueReference, KEYCXX)
433TYPE_TRAIT_1(__is_fundamental, IsFundamental, KEYCXX)
434TYPE_TRAIT_1(__is_object, IsObject, KEYCXX)
435TYPE_TRAIT_1(__is_scalar, IsScalar, KEYCXX)
436TYPE_TRAIT_1(__is_compound, IsCompound, KEYCXX)
437TYPE_TRAIT_1(__is_pointer, IsPointer, KEYCXX)
438TYPE_TRAIT_1(__is_member_object_pointer, IsMemberObjectPointer, KEYCXX)
439TYPE_TRAIT_1(__is_member_function_pointer, IsMemberFunctionPointer, KEYCXX)
440TYPE_TRAIT_1(__is_member_pointer, IsMemberPointer, KEYCXX)
441TYPE_TRAIT_1(__is_const, IsConst, KEYCXX)
442TYPE_TRAIT_1(__is_volatile, IsVolatile, KEYCXX)
443TYPE_TRAIT_1(__is_standard_layout, IsStandardLayout, KEYCXX)
444TYPE_TRAIT_1(__is_signed, IsSigned, KEYCXX)
445TYPE_TRAIT_1(__is_unsigned, IsUnsigned, KEYCXX)
446
447// Embarcadero Binary Type Traits
448TYPE_TRAIT_2(__is_same, IsSame, KEYCXX)
449TYPE_TRAIT_2(__is_convertible, IsConvertible, KEYCXX)
450KEYWORD(__array_rank                , KEYCXX)
451KEYWORD(__array_extent              , KEYCXX)
452
453// Apple Extension.
454KEYWORD(__private_extern__          , KEYALL)
455KEYWORD(__module_private__          , KEYALL)
456
457// Microsoft Extension.
458KEYWORD(__declspec                  , KEYALL)
459KEYWORD(__cdecl                     , KEYALL)
460KEYWORD(__stdcall                   , KEYALL)
461KEYWORD(__fastcall                  , KEYALL)
462KEYWORD(__thiscall                  , KEYALL)
463KEYWORD(__vectorcall                , KEYALL)
464KEYWORD(__forceinline               , KEYMS)
465KEYWORD(__unaligned                 , KEYMS)
466KEYWORD(__super                     , KEYMS)
467
468// OpenCL address space qualifiers
469KEYWORD(__global                    , KEYOPENCL)
470KEYWORD(__local                     , KEYOPENCL)
471KEYWORD(__constant                  , KEYOPENCL)
472KEYWORD(__private                   , KEYOPENCL)
473KEYWORD(__generic                   , KEYOPENCL)
474ALIAS("global", __global            , KEYOPENCL)
475ALIAS("local", __local              , KEYOPENCL)
476ALIAS("constant", __constant        , KEYOPENCL)
477ALIAS("private", __private          , KEYOPENCL)
478ALIAS("generic", __generic          , KEYOPENCL)
479// OpenCL function qualifiers
480KEYWORD(__kernel                    , KEYOPENCL)
481ALIAS("kernel", __kernel            , KEYOPENCL)
482// OpenCL access qualifiers
483KEYWORD(__read_only                 , KEYOPENCL)
484KEYWORD(__write_only                , KEYOPENCL)
485KEYWORD(__read_write                , KEYOPENCL)
486ALIAS("read_only", __read_only      , KEYOPENCL)
487ALIAS("write_only", __write_only    , KEYOPENCL)
488ALIAS("read_write", __read_write    , KEYOPENCL)
489// OpenCL builtins
490KEYWORD(__builtin_astype            , KEYOPENCL)
491KEYWORD(vec_step                    , KEYOPENCL|KEYALTIVEC)
492
493// Borland Extensions.
494KEYWORD(__pascal                    , KEYALL)
495
496// Altivec Extension.
497KEYWORD(__vector                    , KEYALTIVEC)
498KEYWORD(__pixel                     , KEYALTIVEC)
499KEYWORD(__bool                      , KEYALTIVEC)
500
501// ARM NEON extensions.
502ALIAS("__fp16", half                , KEYALL)
503
504// OpenCL Extension.
505KEYWORD(half                        , HALFSUPPORT)
506
507// Objective-C ARC keywords.
508KEYWORD(__bridge                     , KEYARC)
509KEYWORD(__bridge_transfer            , KEYARC)
510KEYWORD(__bridge_retained            , KEYARC)
511KEYWORD(__bridge_retain              , KEYARC)
512
513// Alternate spelling for various tokens.  There are GCC extensions in all
514// languages, but should not be disabled in strict conformance mode.
515ALIAS("__alignof__"  , __alignof  , KEYALL)
516ALIAS("__asm"        , asm        , KEYALL)
517ALIAS("__asm__"      , asm        , KEYALL)
518ALIAS("__attribute__", __attribute, KEYALL)
519ALIAS("__complex"    , _Complex   , KEYALL)
520ALIAS("__complex__"  , _Complex   , KEYALL)
521ALIAS("__const"      , const      , KEYALL)
522ALIAS("__const__"    , const      , KEYALL)
523ALIAS("__decltype"   , decltype   , KEYCXX)
524ALIAS("__imag__"     , __imag     , KEYALL)
525ALIAS("__inline"     , inline     , KEYALL)
526ALIAS("__inline__"   , inline     , KEYALL)
527ALIAS("__nullptr"    , nullptr    , KEYCXX)
528ALIAS("__real__"     , __real     , KEYALL)
529ALIAS("__restrict"   , restrict   , KEYALL)
530ALIAS("__restrict__" , restrict   , KEYALL)
531ALIAS("__signed"     , signed     , KEYALL)
532ALIAS("__signed__"   , signed     , KEYALL)
533ALIAS("__typeof"     , typeof     , KEYALL)
534ALIAS("__typeof__"   , typeof     , KEYALL)
535ALIAS("__volatile"   , volatile   , KEYALL)
536ALIAS("__volatile__" , volatile   , KEYALL)
537
538// Microsoft extensions which should be disabled in strict conformance mode
539KEYWORD(__ptr64                       , KEYMS)
540KEYWORD(__ptr32                       , KEYMS)
541KEYWORD(__sptr                        , KEYMS)
542KEYWORD(__uptr                        , KEYMS)
543KEYWORD(__w64                         , KEYMS)
544KEYWORD(__uuidof                      , KEYMS | KEYBORLAND)
545KEYWORD(__try                         , KEYMS | KEYBORLAND)
546KEYWORD(__finally                     , KEYMS | KEYBORLAND)
547KEYWORD(__leave                       , KEYMS | KEYBORLAND)
548KEYWORD(__int64                       , KEYMS)
549KEYWORD(__if_exists                   , KEYMS)
550KEYWORD(__if_not_exists               , KEYMS)
551KEYWORD(__single_inheritance          , KEYMS)
552KEYWORD(__multiple_inheritance        , KEYMS)
553KEYWORD(__virtual_inheritance         , KEYMS)
554KEYWORD(__interface                   , KEYMS)
555ALIAS("__int8"           , char       , KEYMS)
556ALIAS("_int8"            , char       , KEYMS)
557ALIAS("__int16"          , short      , KEYMS)
558ALIAS("_int16"           , short      , KEYMS)
559ALIAS("__int32"          , int        , KEYMS)
560ALIAS("_int32"           , int        , KEYMS)
561ALIAS("_int64"           , __int64    , KEYMS)
562ALIAS("__wchar_t"        , wchar_t    , KEYMS)
563ALIAS("_asm"             , asm        , KEYMS)
564ALIAS("_alignof"         , __alignof  , KEYMS)
565ALIAS("__builtin_alignof", __alignof  , KEYMS)
566ALIAS("_cdecl"           , __cdecl    , KEYMS | KEYBORLAND)
567ALIAS("_fastcall"        , __fastcall , KEYMS | KEYBORLAND)
568ALIAS("_stdcall"         , __stdcall  , KEYMS | KEYBORLAND)
569ALIAS("_thiscall"        , __thiscall , KEYMS)
570ALIAS("_vectorcall"      , __vectorcall, KEYMS)
571ALIAS("_uuidof"          , __uuidof   , KEYMS | KEYBORLAND)
572ALIAS("_inline"          , inline     , KEYMS)
573ALIAS("_declspec"        , __declspec , KEYMS)
574
575// Borland Extensions which should be disabled in strict conformance mode.
576ALIAS("_pascal"      , __pascal   , KEYBORLAND)
577
578// Clang Extensions.
579KEYWORD(__builtin_convertvector   , KEYALL)
580ALIAS("__char16_t"   , char16_t   , KEYCXX)
581ALIAS("__char32_t"   , char32_t   , KEYCXX)
582
583// Clang-specific keywords enabled only in testing.
584TESTING_KEYWORD(__unknown_anytype , KEYALL)
585
586
587//===----------------------------------------------------------------------===//
588// Objective-C @-preceded keywords.
589//===----------------------------------------------------------------------===//
590
591// These have meaning after an '@' in Objective-C mode. These define enums in
592// the tok::objc_* namespace.
593
594OBJC1_AT_KEYWORD(not_keyword)
595OBJC1_AT_KEYWORD(class)
596OBJC1_AT_KEYWORD(compatibility_alias)
597OBJC1_AT_KEYWORD(defs)
598OBJC1_AT_KEYWORD(encode)
599OBJC1_AT_KEYWORD(end)
600OBJC1_AT_KEYWORD(implementation)
601OBJC1_AT_KEYWORD(interface)
602OBJC1_AT_KEYWORD(private)
603OBJC1_AT_KEYWORD(protected)
604OBJC1_AT_KEYWORD(protocol)
605OBJC1_AT_KEYWORD(public)
606OBJC1_AT_KEYWORD(selector)
607OBJC1_AT_KEYWORD(throw)
608OBJC1_AT_KEYWORD(try)
609OBJC1_AT_KEYWORD(catch)
610OBJC1_AT_KEYWORD(finally)
611OBJC1_AT_KEYWORD(synchronized)
612OBJC1_AT_KEYWORD(autoreleasepool)
613
614OBJC2_AT_KEYWORD(property)
615OBJC2_AT_KEYWORD(package)
616OBJC2_AT_KEYWORD(required)
617OBJC2_AT_KEYWORD(optional)
618OBJC2_AT_KEYWORD(synthesize)
619OBJC2_AT_KEYWORD(dynamic)
620OBJC2_AT_KEYWORD(import)
621
622// TODO: What to do about context-sensitive keywords like:
623//       bycopy/byref/in/inout/oneway/out?
624
625ANNOTATION(cxxscope)     // annotation for a C++ scope spec, e.g. "::foo::bar::"
626ANNOTATION(typename)     // annotation for a C typedef name, a C++ (possibly
627                         // qualified) typename, e.g. "foo::MyClass", or
628                         // template-id that names a type ("std::vector<int>")
629ANNOTATION(template_id)  // annotation for a C++ template-id that names a
630                         // function template specialization (not a type),
631                         // e.g., "std::swap<int>"
632ANNOTATION(primary_expr) // annotation for a primary expression
633ANNOTATION(decltype)     // annotation for a decltype expression,
634                         // e.g., "decltype(foo.bar())"
635
636// Annotation for #pragma unused(...)
637// For each argument inside the parentheses the pragma handler will produce
638// one 'pragma_unused' annotation token followed by the argument token.
639ANNOTATION(pragma_unused)
640
641// Annotation for #pragma GCC visibility...
642// The lexer produces these so that they only take effect when the parser
643// handles them.
644ANNOTATION(pragma_vis)
645
646// Annotation for #pragma pack...
647// The lexer produces these so that they only take effect when the parser
648// handles them.
649ANNOTATION(pragma_pack)
650
651// Annotation for #pragma clang __debug parser_crash...
652// The lexer produces these so that they only take effect when the parser
653// handles them.
654ANNOTATION(pragma_parser_crash)
655
656// Annotation for #pragma clang __debug captured...
657// The lexer produces these so that they only take effect when the parser
658// handles them.
659ANNOTATION(pragma_captured)
660
661// Annotation for #pragma ms_struct...
662// The lexer produces these so that they only take effect when the parser
663// handles them.
664ANNOTATION(pragma_msstruct)
665
666// Annotation for #pragma align...
667// The lexer produces these so that they only take effect when the parser
668// handles them.
669ANNOTATION(pragma_align)
670
671// Annotation for #pragma weak id
672// The lexer produces these so that they only take effect when the parser
673// handles them.
674ANNOTATION(pragma_weak)
675
676// Annotation for #pragma weak id = id
677// The lexer produces these so that they only take effect when the parser
678// handles them.
679ANNOTATION(pragma_weakalias)
680
681// Annotation for #pragma redefine_extname...
682// The lexer produces these so that they only take effect when the parser
683// handles them.
684ANNOTATION(pragma_redefine_extname)
685
686// Annotation for #pragma STDC FP_CONTRACT...
687// The lexer produces these so that they only take effect when the parser
688// handles them.
689ANNOTATION(pragma_fp_contract)
690
691// Annotation for #pragma pointers_to_members...
692// The lexer produces these so that they only take effect when the parser
693// handles them.
694ANNOTATION(pragma_ms_pointers_to_members)
695
696// Annotation for #pragma vtordisp...
697// The lexer produces these so that they only take effect when the parser
698// handles them.
699ANNOTATION(pragma_ms_vtordisp)
700
701// Annotation for all microsoft #pragmas...
702// The lexer produces these so that they only take effect when the parser
703// handles them.
704ANNOTATION(pragma_ms_pragma)
705
706// Annotation for #pragma OPENCL EXTENSION...
707// The lexer produces these so that they only take effect when the parser
708// handles them.
709ANNOTATION(pragma_opencl_extension)
710
711// Annotations for OpenMP pragma directives - #pragma omp ...
712// The lexer produces these so that they only take effect when the parser
713// handles #pragma omp ... directives.
714ANNOTATION(pragma_openmp)
715ANNOTATION(pragma_openmp_end)
716
717// Annotations for loop pragma directives #pragma clang loop ...
718// The lexer produces these so that they only take effect when the parser
719// handles #pragma loop ... directives.
720ANNOTATION(pragma_loop_hint)
721
722// Annotations for module import translated from #include etc.
723ANNOTATION(module_include)
724ANNOTATION(module_begin)
725ANNOTATION(module_end)
726
727#undef ANNOTATION
728#undef TESTING_KEYWORD
729#undef OBJC2_AT_KEYWORD
730#undef OBJC1_AT_KEYWORD
731#undef CXX_KEYWORD_OPERATOR
732#undef PPKEYWORD
733#undef ALIAS
734#undef TYPE_TRAIT_N
735#undef TYPE_TRAIT_2
736#undef TYPE_TRAIT_1
737#undef TYPE_TRAIT
738#undef KEYWORD
739#undef PUNCTUATOR
740#undef TOK
741