clang  14.0.0git
TypeTraits.h
Go to the documentation of this file.
1 //===--- TypeTraits.h - C++ Type Traits Support Enumerations ----*- 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 /// \file
10 /// Defines enumerations for the type traits support.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_BASIC_TYPETRAITS_H
15 #define LLVM_CLANG_BASIC_TYPETRAITS_H
16 
17 #include "llvm/Support/Compiler.h"
18 
19 namespace clang {
20 /// Names for traits that operate specifically on types.
21 enum TypeTrait {
22 #define TYPE_TRAIT_1(Spelling, Name, Key) UTT_##Name,
23 #include "clang/Basic/TokenKinds.def"
24  UTT_Last = -1 // UTT_Last == last UTT_XX in the enum.
25 #define TYPE_TRAIT_1(Spelling, Name, Key) +1
26 #include "clang/Basic/TokenKinds.def"
27  ,
28 #define TYPE_TRAIT_2(Spelling, Name, Key) BTT_##Name,
29 #include "clang/Basic/TokenKinds.def"
30  BTT_Last = UTT_Last // BTT_Last == last BTT_XX in the enum.
31 #define TYPE_TRAIT_2(Spelling, Name, Key) +1
32 #include "clang/Basic/TokenKinds.def"
33  ,
34 #define TYPE_TRAIT_N(Spelling, Name, Key) TT_##Name,
35 #include "clang/Basic/TokenKinds.def"
36  TT_Last = BTT_Last // TT_Last == last TT_XX in the enum.
37 #define TYPE_TRAIT_N(Spelling, Name, Key) +1
38 #include "clang/Basic/TokenKinds.def"
39 };
40 
41 /// Names for the array type traits.
43 #define ARRAY_TYPE_TRAIT(Spelling, Name, Key) ATT_##Name,
44 #include "clang/Basic/TokenKinds.def"
45  ATT_Last = -1 // ATT_Last == last ATT_XX in the enum.
46 #define ARRAY_TYPE_TRAIT(Spelling, Name, Key) +1
47 #include "clang/Basic/TokenKinds.def"
48 };
49 
50 /// Names for the "expression or type" traits.
52 #define UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) UETT_##Name,
53 #define CXX11_UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) UETT_##Name,
54 #include "clang/Basic/TokenKinds.def"
55  UETT_Last = -1 // UETT_Last == last UETT_XX in the enum.
56 #define UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) +1
57 #define CXX11_UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) +1
58 #include "clang/Basic/TokenKinds.def"
59 };
60 
61 /// Return the internal name of type trait \p T. Never null.
62 const char *getTraitName(TypeTrait T) LLVM_READONLY;
63 const char *getTraitName(ArrayTypeTrait T) LLVM_READONLY;
64 const char *getTraitName(UnaryExprOrTypeTrait T) LLVM_READONLY;
65 
66 /// Return the spelling of the type trait \p TT. Never null.
67 const char *getTraitSpelling(TypeTrait T) LLVM_READONLY;
68 const char *getTraitSpelling(ArrayTypeTrait T) LLVM_READONLY;
69 const char *getTraitSpelling(UnaryExprOrTypeTrait T) LLVM_READONLY;
70 } // namespace clang
71 
72 #endif
clang::ArrayTypeTrait
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:42
clang::UTT_Last
@ UTT_Last
Definition: TypeTraits.h:24
clang::getTraitName
const char * getTraitName(ExpressionTrait T) LLVM_READONLY
Return the internal name of type trait T. Never null.
Definition: ExpressionTraits.cpp:28
clang::TypeTrait
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
clang::getTraitSpelling
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
Definition: ExpressionTraits.cpp:33
clang::ATT_Last
@ ATT_Last
Definition: TypeTraits.h:45
clang::UETT_Last
@ UETT_Last
Definition: TypeTraits.h:55
clang
Definition: CalledOnceCheck.h:17
clang::BTT_Last
@ BTT_Last
Definition: TypeTraits.h:30
clang::TT_Last
@ TT_Last
Definition: TypeTraits.h:36
clang::UnaryExprOrTypeTrait
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:51