]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / tools / clang / include / clang / Basic / Specifiers.h
1 //===--- Specifiers.h - Declaration and Type Specifiers ---------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines various enumerations that describe declaration and
11 // type specifiers.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H
16 #define LLVM_CLANG_BASIC_SPECIFIERS_H
17
18 namespace clang {
19   /// \brief Specifies the width of a type, e.g., short, long, or long long.
20   enum TypeSpecifierWidth {
21     TSW_unspecified,
22     TSW_short,
23     TSW_long,
24     TSW_longlong
25   };
26   
27   /// \brief Specifies the signedness of a type, e.g., signed or unsigned.
28   enum TypeSpecifierSign {
29     TSS_unspecified,
30     TSS_signed,
31     TSS_unsigned
32   };
33   
34   /// \brief Specifies the kind of type.
35   enum TypeSpecifierType {
36     TST_unspecified,
37     TST_void,
38     TST_char,
39     TST_wchar,        // C++ wchar_t
40     TST_char16,       // C++0x char16_t
41     TST_char32,       // C++0x char32_t
42     TST_int,
43     TST_half,         // OpenCL half, ARM NEON __fp16
44     TST_float,
45     TST_double,
46     TST_bool,         // _Bool
47     TST_decimal32,    // _Decimal32
48     TST_decimal64,    // _Decimal64
49     TST_decimal128,   // _Decimal128
50     TST_enum,
51     TST_union,
52     TST_struct,
53     TST_class,        // C++ class type
54     TST_typename,     // Typedef, C++ class-name or enum name, etc.
55     TST_typeofType,
56     TST_typeofExpr,
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
63   };
64   
65   /// WrittenBuiltinSpecs - Structure that packs information about the 
66   /// type specifiers that were written in a particular type specifier
67   /// sequence.
68   struct WrittenBuiltinSpecs {
69     /*DeclSpec::TST*/ unsigned Type  : 5;
70     /*DeclSpec::TSS*/ unsigned Sign  : 2;
71     /*DeclSpec::TSW*/ unsigned Width : 2;
72     bool ModeAttr : 1;
73   };  
74
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 {
79     AS_public,
80     AS_protected,
81     AS_private,
82     AS_none
83   };
84
85   /// ExprValueKind - The categorization of expression values,
86   /// currently following the C++0x scheme.
87   enum ExprValueKind {
88     /// An r-value expression (a pr-value in the C++0x taxonomy)
89     /// produces a temporary value.
90     VK_RValue,
91
92     /// An l-value expression is a reference to an object with
93     /// independent storage.
94     VK_LValue,
95
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.
99     VK_XValue
100   };
101
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.
106     OK_Ordinary,
107
108     /// A bitfield object is a bitfield on a C or C++ record.
109     OK_BitField,
110
111     /// A vector component is an element or range of elements on a vector.
112     OK_VectorComponent,
113
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.
116     OK_ObjCProperty
117   };
118
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.
124     TSK_Undeclared = 0,
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
140   };
141
142   /// \brief Storage classes.
143   enum StorageClass {
144     // These are legal on both functions and variables.
145     SC_None,
146     SC_Extern,
147     SC_Static,
148     SC_PrivateExtern,
149
150     // These are only legal on variables.
151     SC_OpenCLWorkGroupLocal,
152     SC_Auto,
153     SC_Register
154   };
155
156   /// Checks whether the given storage class is legal for functions.
157   inline bool isLegalForFunction(StorageClass SC) {
158     return SC <= SC_PrivateExtern;
159   }
160
161   /// Checks whether the given storage class is legal for variables.
162   inline bool isLegalForVariable(StorageClass SC) {
163     return true;
164   }
165 } // end namespace clang
166
167 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H