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