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