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
43 TST_half, // OpenCL half, ARM NEON __fp16
47 TST_decimal32, // _Decimal32
48 TST_decimal64, // _Decimal64
49 TST_decimal128, // _Decimal128
53 TST_class, // C++ class type
54 TST_typename, // Typedef, C++ class-name or enum name, etc.
57 TST_decltype, // C++0x decltype
58 TST_underlyingType, // __underlying_type for C++0x
59 TST_auto, // C++0x auto
60 TST_unknown_anytype, // __unknown_anytype extension
61 TST_atomic, // C1X _Atomic
62 TST_error // erroneous type
65 /// WrittenBuiltinSpecs - Structure that packs information about the
66 /// type specifiers that were written in a particular type specifier
68 struct WrittenBuiltinSpecs {
69 /*DeclSpec::TST*/ unsigned Type : 5;
70 /*DeclSpec::TSS*/ unsigned Sign : 2;
71 /*DeclSpec::TSW*/ unsigned Width : 2;
75 /// AccessSpecifier - A C++ access specifier (public, private,
76 /// protected), plus the special value "none" which means
77 /// different things in different contexts.
78 enum AccessSpecifier {
85 /// ExprValueKind - The categorization of expression values,
86 /// currently following the C++0x scheme.
88 /// An r-value expression (a pr-value in the C++0x taxonomy)
89 /// produces a temporary value.
92 /// An l-value expression is a reference to an object with
93 /// independent storage.
96 /// An x-value expression is a reference to an object with
97 /// independent storage but which can be "moved", i.e.
98 /// efficiently cannibalized for its resources.
102 /// A further classification of the kind of object referenced by an
103 /// l-value or x-value.
104 enum ExprObjectKind {
105 /// An ordinary object is located at an address in memory.
108 /// A bitfield object is a bitfield on a C or C++ record.
111 /// A vector component is an element or range of elements on a vector.
114 /// An Objective C property is a logical field of an Objective-C
115 /// object which is read and written via Objective C method calls.
119 // \brief Describes the kind of template specialization that a
120 // particular template specialization declaration represents.
121 enum TemplateSpecializationKind {
122 /// This template specialization was formed from a template-id but
123 /// has not yet been declared, defined, or instantiated.
125 /// This template specialization was implicitly instantiated from a
126 /// template. (C++ [temp.inst]).
127 TSK_ImplicitInstantiation,
128 /// This template specialization was declared or defined by an
129 /// explicit specialization (C++ [temp.expl.spec]) or partial
130 /// specialization (C++ [temp.class.spec]).
131 TSK_ExplicitSpecialization,
132 /// This template specialization was instantiated from a template
133 /// due to an explicit instantiation declaration request
134 /// (C++0x [temp.explicit]).
135 TSK_ExplicitInstantiationDeclaration,
136 /// This template specialization was instantiated from a template
137 /// due to an explicit instantiation definition request
138 /// (C++ [temp.explicit]).
139 TSK_ExplicitInstantiationDefinition
142 /// \brief Storage classes.
144 // These are legal on both functions and variables.
150 // These are only legal on variables.
151 SC_OpenCLWorkGroupLocal,
156 /// Checks whether the given storage class is legal for functions.
157 inline bool isLegalForFunction(StorageClass SC) {
158 return SC <= SC_PrivateExtern;
161 /// Checks whether the given storage class is legal for variables.
162 inline bool isLegalForVariable(StorageClass SC) {
165 } // end namespace clang
167 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H