Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:51

0001 //===--- TypeTraits.h - C++ Type Traits Support Enumerations ----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// \file
0010 /// Defines enumerations for the type traits support.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_BASIC_TYPETRAITS_H
0015 #define LLVM_CLANG_BASIC_TYPETRAITS_H
0016 
0017 #include "llvm/Support/Compiler.h"
0018 
0019 namespace clang {
0020 /// Names for traits that operate specifically on types.
0021 enum TypeTrait {
0022 #define TYPE_TRAIT_1(Spelling, Name, Key) UTT_##Name,
0023 #include "clang/Basic/TokenKinds.def"
0024   UTT_Last = -1 // UTT_Last == last UTT_XX in the enum.
0025 #define TYPE_TRAIT_1(Spelling, Name, Key) +1
0026 #include "clang/Basic/TokenKinds.def"
0027   ,
0028 #define TYPE_TRAIT_2(Spelling, Name, Key) BTT_##Name,
0029 #include "clang/Basic/TokenKinds.def"
0030   BTT_Last = UTT_Last // BTT_Last == last BTT_XX in the enum.
0031 #define TYPE_TRAIT_2(Spelling, Name, Key) +1
0032 #include "clang/Basic/TokenKinds.def"
0033   ,
0034 #define TYPE_TRAIT_N(Spelling, Name, Key) TT_##Name,
0035 #include "clang/Basic/TokenKinds.def"
0036   TT_Last = BTT_Last // TT_Last == last TT_XX in the enum.
0037 #define TYPE_TRAIT_N(Spelling, Name, Key) +1
0038 #include "clang/Basic/TokenKinds.def"
0039 };
0040 
0041 /// Names for the array type traits.
0042 enum ArrayTypeTrait {
0043 #define ARRAY_TYPE_TRAIT(Spelling, Name, Key) ATT_##Name,
0044 #include "clang/Basic/TokenKinds.def"
0045   ATT_Last = -1 // ATT_Last == last ATT_XX in the enum.
0046 #define ARRAY_TYPE_TRAIT(Spelling, Name, Key) +1
0047 #include "clang/Basic/TokenKinds.def"
0048 };
0049 
0050 /// Names for the "expression or type" traits.
0051 enum UnaryExprOrTypeTrait {
0052 #define UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) UETT_##Name,
0053 #define CXX11_UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) UETT_##Name,
0054 #include "clang/Basic/TokenKinds.def"
0055   UETT_Last = -1 // UETT_Last == last UETT_XX in the enum.
0056 #define UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) +1
0057 #define CXX11_UNARY_EXPR_OR_TYPE_TRAIT(Spelling, Name, Key) +1
0058 #include "clang/Basic/TokenKinds.def"
0059 };
0060 
0061 /// Return the internal name of type trait \p T. Never null.
0062 const char *getTraitName(TypeTrait T) LLVM_READONLY;
0063 const char *getTraitName(ArrayTypeTrait T) LLVM_READONLY;
0064 const char *getTraitName(UnaryExprOrTypeTrait T) LLVM_READONLY;
0065 
0066 /// Return the spelling of the type trait \p TT. Never null.
0067 const char *getTraitSpelling(TypeTrait T) LLVM_READONLY;
0068 const char *getTraitSpelling(ArrayTypeTrait T) LLVM_READONLY;
0069 const char *getTraitSpelling(UnaryExprOrTypeTrait T) LLVM_READONLY;
0070 
0071 /// Return the arity of the type trait \p T.
0072 unsigned getTypeTraitArity(TypeTrait T) LLVM_READONLY;
0073 
0074 } // namespace clang
0075 
0076 #endif