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 //===----------------------------------------------------------------------===//
10 // This file defines various enumerations that describe declaration and
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H
16 #define LLVM_CLANG_BASIC_SPECIFIERS_H
19 /// \brief Specifies the width of a type, e.g., short, long, or long long.
20 enum TypeSpecifierWidth {
27 /// \brief Specifies the signedness of a type, e.g., signed or unsigned.
28 enum TypeSpecifierSign {
34 /// \brief Specifies the kind of type.
35 enum TypeSpecifierType {
39 TST_wchar, // C++ wchar_t
40 TST_char16, // C++0x char16_t
41 TST_char32, // C++0x char32_t
44 TST_half, // OpenCL half, ARM NEON __fp16
48 TST_decimal32, // _Decimal32
49 TST_decimal64, // _Decimal64
50 TST_decimal128, // _Decimal128
54 TST_class, // C++ class type
55 TST_typename, // Typedef, C++ class-name or enum name, etc.
58 TST_decltype, // C++0x decltype
59 TST_underlyingType, // __underlying_type for C++0x
60 TST_auto, // C++0x auto
61 TST_unknown_anytype, // __unknown_anytype extension
62 TST_atomic, // C11 _Atomic
63 TST_error // erroneous type
66 /// WrittenBuiltinSpecs - Structure that packs information about the
67 /// type specifiers that were written in a particular type specifier
69 struct WrittenBuiltinSpecs {
70 /*DeclSpec::TST*/ unsigned Type : 5;
71 /*DeclSpec::TSS*/ unsigned Sign : 2;
72 /*DeclSpec::TSW*/ unsigned Width : 2;
76 /// AccessSpecifier - A C++ access specifier (public, private,
77 /// protected), plus the special value "none" which means
78 /// different things in different contexts.
79 enum AccessSpecifier {
86 /// ExprValueKind - The categorization of expression values,
87 /// currently following the C++0x scheme.
89 /// An r-value expression (a pr-value in the C++0x taxonomy)
90 /// produces a temporary value.
93 /// An l-value expression is a reference to an object with
94 /// independent storage.
97 /// An x-value expression is a reference to an object with
98 /// independent storage but which can be "moved", i.e.
99 /// efficiently cannibalized for its resources.
103 /// A further classification of the kind of object referenced by an
104 /// l-value or x-value.
105 enum ExprObjectKind {
106 /// An ordinary object is located at an address in memory.
109 /// A bitfield object is a bitfield on a C or C++ record.
112 /// A vector component is an element or range of elements on a vector.
115 /// An Objective C property is a logical field of an Objective-C
116 /// object which is read and written via Objective C method calls.
119 /// An Objective C array/dictionary subscripting which reads an object
120 /// or writes at the subscripted array/dictionary element via
121 /// Objective C method calls.
125 // \brief Describes the kind of template specialization that a
126 // particular template specialization declaration represents.
127 enum TemplateSpecializationKind {
128 /// This template specialization was formed from a template-id but
129 /// has not yet been declared, defined, or instantiated.
131 /// This template specialization was implicitly instantiated from a
132 /// template. (C++ [temp.inst]).
133 TSK_ImplicitInstantiation,
134 /// This template specialization was declared or defined by an
135 /// explicit specialization (C++ [temp.expl.spec]) or partial
136 /// specialization (C++ [temp.class.spec]).
137 TSK_ExplicitSpecialization,
138 /// This template specialization was instantiated from a template
139 /// due to an explicit instantiation declaration request
140 /// (C++0x [temp.explicit]).
141 TSK_ExplicitInstantiationDeclaration,
142 /// This template specialization was instantiated from a template
143 /// due to an explicit instantiation definition request
144 /// (C++ [temp.explicit]).
145 TSK_ExplicitInstantiationDefinition
148 /// \brief Storage classes.
150 // These are legal on both functions and variables.
156 // These are only legal on variables.
157 SC_OpenCLWorkGroupLocal,
162 /// Checks whether the given storage class is legal for functions.
163 inline bool isLegalForFunction(StorageClass SC) {
164 return SC <= SC_PrivateExtern;
167 /// Checks whether the given storage class is legal for variables.
168 inline bool isLegalForVariable(StorageClass SC) {
171 } // end namespace clang
173 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H