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