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