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
46 TST_decimal32, // _Decimal32
47 TST_decimal64, // _Decimal64
48 TST_decimal128, // _Decimal128
52 TST_class, // C++ class type
53 TST_typename, // Typedef, C++ class-name or enum name, etc.
56 TST_decltype, // C++0x decltype
57 TST_underlyingType, // __underlying_type for C++0x
58 TST_auto, // C++0x auto
59 TST_unknown_anytype, // __unknown_anytype extension
60 TST_error // erroneous type
63 /// WrittenBuiltinSpecs - Structure that packs information about the
64 /// type specifiers that were written in a particular type specifier
66 struct WrittenBuiltinSpecs {
67 /*DeclSpec::TST*/ unsigned Type : 5;
68 /*DeclSpec::TSS*/ unsigned Sign : 2;
69 /*DeclSpec::TSW*/ unsigned Width : 2;
73 /// AccessSpecifier - A C++ access specifier (public, private,
74 /// protected), plus the special value "none" which means
75 /// different things in different contexts.
76 enum AccessSpecifier {
83 /// ExprValueKind - The categorization of expression values,
84 /// currently following the C++0x scheme.
86 /// An r-value expression (a pr-value in the C++0x taxonomy)
87 /// produces a temporary value.
90 /// An l-value expression is a reference to an object with
91 /// independent storage.
94 /// An x-value expression is a reference to an object with
95 /// independent storage but which can be "moved", i.e.
96 /// efficiently cannibalized for its resources.
100 /// A further classification of the kind of object referenced by an
101 /// l-value or x-value.
102 enum ExprObjectKind {
103 /// An ordinary object is located at an address in memory.
106 /// A bitfield object is a bitfield on a C or C++ record.
109 /// A vector component is an element or range of elements on a vector.
112 /// An Objective C property is a logical field of an Objective-C
113 /// object which is read and written via Objective C method calls.
117 // \brief Describes the kind of template specialization that a
118 // particular template specialization declaration represents.
119 enum TemplateSpecializationKind {
120 /// This template specialization was formed from a template-id but
121 /// has not yet been declared, defined, or instantiated.
123 /// This template specialization was implicitly instantiated from a
124 /// template. (C++ [temp.inst]).
125 TSK_ImplicitInstantiation,
126 /// This template specialization was declared or defined by an
127 /// explicit specialization (C++ [temp.expl.spec]) or partial
128 /// specialization (C++ [temp.class.spec]).
129 TSK_ExplicitSpecialization,
130 /// This template specialization was instantiated from a template
131 /// due to an explicit instantiation declaration request
132 /// (C++0x [temp.explicit]).
133 TSK_ExplicitInstantiationDeclaration,
134 /// This template specialization was instantiated from a template
135 /// due to an explicit instantiation definition request
136 /// (C++ [temp.explicit]).
137 TSK_ExplicitInstantiationDefinition
140 /// \brief Storage classes.
142 // These are legal on both functions and variables.
148 // These are only legal on variables.
153 /// Checks whether the given storage class is legal for functions.
154 inline bool isLegalForFunction(StorageClass SC) {
155 return SC <= SC_PrivateExtern;
158 /// Checks whether the given storage class is legal for variables.
159 inline bool isLegalForVariable(StorageClass SC) {
162 } // end namespace clang
164 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H