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