1 //===--- Specifiers.h - Declaration and Type Specifiers ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Defines various enumerations that describe declaration and
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H
17 #define LLVM_CLANG_BASIC_SPECIFIERS_H
20 /// \brief Specifies the width of a type, e.g., short, long, or long long.
21 enum TypeSpecifierWidth {
28 /// \brief Specifies the signedness of a type, e.g., signed or unsigned.
29 enum TypeSpecifierSign {
35 /// \brief Specifies the kind of type.
36 enum TypeSpecifierType {
40 TST_wchar, // C++ wchar_t
41 TST_char16, // C++11 char16_t
42 TST_char32, // C++11 char32_t
45 TST_half, // OpenCL half, ARM NEON __fp16
49 TST_decimal32, // _Decimal32
50 TST_decimal64, // _Decimal64
51 TST_decimal128, // _Decimal128
55 TST_class, // C++ class type
56 TST_interface, // C++ (Microsoft-specific) __interface type
57 TST_typename, // Typedef, C++ class-name or enum name, etc.
60 TST_decltype, // C++11 decltype
61 TST_underlyingType, // __underlying_type for C++11
62 TST_auto, // C++11 auto
63 TST_decltype_auto, // C++1y decltype(auto)
64 TST_unknown_anytype, // __unknown_anytype extension
65 TST_atomic, // C11 _Atomic
66 TST_image1d_t, // OpenCL image1d_t
67 TST_image1d_array_t, // OpenCL image1d_array_t
68 TST_image1d_buffer_t, // OpenCL image1d_buffer_t
69 TST_image2d_t, // OpenCL image2d_t
70 TST_image2d_array_t, // OpenCL image2d_array_t
71 TST_image3d_t, // OpenCL image3d_t
72 TST_sampler_t, // OpenCL sampler_t
73 TST_event_t, // OpenCL event_t
74 TST_error // erroneous type
77 /// \brief Structure that packs information about the type specifiers that
78 /// were written in a particular type specifier sequence.
79 struct WrittenBuiltinSpecs {
80 /*DeclSpec::TST*/ unsigned Type : 6;
81 /*DeclSpec::TSS*/ unsigned Sign : 2;
82 /*DeclSpec::TSW*/ unsigned Width : 2;
86 /// \brief A C++ access specifier (public, private, protected), plus the
87 /// special value "none" which means different things in different contexts.
88 enum AccessSpecifier {
95 /// \brief The categorization of expression values, currently following the
98 /// \brief An r-value expression (a pr-value in the C++11 taxonomy)
99 /// produces a temporary value.
102 /// \brief An l-value expression is a reference to an object with
103 /// independent storage.
106 /// \brief An x-value expression is a reference to an object with
107 /// independent storage but which can be "moved", i.e.
108 /// efficiently cannibalized for its resources.
112 /// \brief A further classification of the kind of object referenced by an
113 /// l-value or x-value.
114 enum ExprObjectKind {
115 /// An ordinary object is located at an address in memory.
118 /// A bitfield object is a bitfield on a C or C++ record.
121 /// A vector component is an element or range of elements on a vector.
124 /// An Objective-C property is a logical field of an Objective-C
125 /// object which is read and written via Objective-C method calls.
128 /// An Objective-C array/dictionary subscripting which reads an
129 /// object or writes at the subscripted array/dictionary element via
130 /// Objective-C method calls.
134 // \brief Describes the kind of template specialization that a
135 // particular template specialization declaration represents.
136 enum TemplateSpecializationKind {
137 /// This template specialization was formed from a template-id but
138 /// has not yet been declared, defined, or instantiated.
140 /// This template specialization was implicitly instantiated from a
141 /// template. (C++ [temp.inst]).
142 TSK_ImplicitInstantiation,
143 /// This template specialization was declared or defined by an
144 /// explicit specialization (C++ [temp.expl.spec]) or partial
145 /// specialization (C++ [temp.class.spec]).
146 TSK_ExplicitSpecialization,
147 /// This template specialization was instantiated from a template
148 /// due to an explicit instantiation declaration request
149 /// (C++11 [temp.explicit]).
150 TSK_ExplicitInstantiationDeclaration,
151 /// This template specialization was instantiated from a template
152 /// due to an explicit instantiation definition request
153 /// (C++ [temp.explicit]).
154 TSK_ExplicitInstantiationDefinition
157 /// \brief Thread storage-class-specifier.
158 enum ThreadStorageClassSpecifier {
162 /// C++11 thread_local. Implies 'static' at block scope, but not at
165 /// C11 _Thread_local. Must be combined with either 'static' or 'extern'
166 /// if used at block scope.
170 /// \brief Storage classes.
172 // These are legal on both functions and variables.
178 // These are only legal on variables.
179 SC_OpenCLWorkGroupLocal,
184 /// \brief Checks whether the given storage class is legal for functions.
185 inline bool isLegalForFunction(StorageClass SC) {
186 return SC <= SC_PrivateExtern;
189 /// \brief Checks whether the given storage class is legal for variables.
190 inline bool isLegalForVariable(StorageClass SC) {
194 /// \brief In-class initialization styles for non-static data members.
195 enum InClassInitStyle {
196 ICIS_NoInit, ///< No in-class initializer.
197 ICIS_CopyInit, ///< Copy initialization.
198 ICIS_ListInit ///< Direct list-initialization.
201 /// \brief CallingConv - Specifies the calling convention that a function uses.
204 CC_C, // __attribute__((cdecl))
205 CC_X86StdCall, // __attribute__((stdcall))
206 CC_X86FastCall, // __attribute__((fastcall))
207 CC_X86ThisCall, // __attribute__((thiscall))
208 CC_X86Pascal, // __attribute__((pascal))
209 CC_X86_64Win64, // __attribute__((ms_abi))
210 CC_X86_64SysV, // __attribute__((sysv_abi))
211 CC_AAPCS, // __attribute__((pcs("aapcs")))
212 CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp")))
213 CC_PnaclCall, // __attribute__((pnaclcall))
214 CC_IntelOclBicc // __attribute__((intel_ocl_bicc))
217 } // end namespace clang
219 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H