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