]> granicus.if.org Git - clang/blob - include/clang/AST/OperationKinds.h
Assorted work leading towards the elimination of CK_Unknown.
[clang] / include / clang / AST / OperationKinds.h
1 //===- OperationKinds.h - Operation enums -----------------------*- 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 enumerates the different kinds of operations that can be
11 // performed by various expressions.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CLANG_AST_OPERATION_KINDS_H
16 #define LLVM_CLANG_AST_OPERATION_KINDS_H
17
18 namespace clang {
19   
20 /// CastKind - the kind of cast this represents.
21 enum CastKind {
22   /// CK_Unknown - Unknown cast kind.
23   /// FIXME: The goal is to get rid of this and make all casts have a
24   /// kind so that the AST client doesn't have to try to figure out what's
25   /// going on.
26   CK_Unknown,
27
28   /// CK_Dependent - This explicit cast cannot yet be analyzed because
29   /// the type or expression is dependent.
30   CK_Dependent,
31
32   /// CK_BitCast - Used for reinterpret_cast.
33   CK_BitCast,
34
35   /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
36   /// a reference type.
37   CK_LValueBitCast,
38     
39   /// CK_NoOp - Used for const_cast.
40   CK_NoOp,
41
42   /// CK_BaseToDerived - Base to derived class casts.
43   CK_BaseToDerived,
44
45   /// CK_DerivedToBase - Derived to base class casts.
46   CK_DerivedToBase,
47
48   /// CK_UncheckedDerivedToBase - Derived to base class casts that
49   /// assume that the derived pointer is not null.
50   CK_UncheckedDerivedToBase,
51
52   /// CK_Dynamic - Dynamic cast.
53   CK_Dynamic,
54
55   /// CK_ToUnion - Cast to union (GCC extension).
56   CK_ToUnion,
57
58   /// CK_ArrayToPointerDecay - Array to pointer decay.
59   CK_ArrayToPointerDecay,
60
61   /// CK_FunctionToPointerDecay - Function to pointer decay.
62   CK_FunctionToPointerDecay,
63
64   /// CK_NullToPointer - Null pointer to pointer.
65   CK_NullToPointer,
66
67   /// CK_NullToMemberPointer - Null pointer to member pointer.
68   CK_NullToMemberPointer,
69
70   /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
71   /// member pointer in derived class.
72   CK_BaseToDerivedMemberPointer,
73
74   /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
75   /// member pointer in base class.
76   CK_DerivedToBaseMemberPointer,
77     
78   /// CK_UserDefinedConversion - Conversion using a user defined type
79   /// conversion function.
80   CK_UserDefinedConversion,
81
82   /// CK_ConstructorConversion - Conversion by constructor
83   CK_ConstructorConversion,
84     
85   /// CK_IntegralToPointer - Integral to pointer
86   CK_IntegralToPointer,
87     
88   /// CK_PointerToIntegral - Pointer to integral
89   CK_PointerToIntegral,
90
91   /// CK_PointerToBoolean - Pointer to boolean (i.e. is not null)
92   CK_PointerToBoolean,
93     
94   /// CK_ToVoid - Cast to void.
95   CK_ToVoid,
96     
97   /// CK_VectorSplat - Casting from an integer/floating type to an extended
98   /// vector type with the same element type as the src type. Splats the 
99   /// src expression into the destination expression.
100   CK_VectorSplat,
101     
102   /// CK_IntegralCast - A truncating or extending cast between integral
103   /// types of different size.
104   CK_IntegralCast,
105
106   /// CK_IntegralToBoolean - Integral to boolean.
107   CK_IntegralToBoolean,
108
109   /// CK_IntegralToFloating - Integral to floating point.
110   CK_IntegralToFloating,
111     
112   /// CK_FloatingToIntegral - Floating point to integral.
113   CK_FloatingToIntegral,
114
115   /// CK_FloatingToBoolean - Floating point to boolean.
116   CK_FloatingToBoolean,
117     
118   /// CK_FloatingCast - Casting between floating types of different size.
119   CK_FloatingCast,
120     
121   /// CK_MemberPointerToBoolean - Member pointer to boolean
122   CK_MemberPointerToBoolean,
123
124   /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c 
125   /// pointer
126   CK_AnyPointerToObjCPointerCast,
127
128   /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block 
129   /// pointer
130   CK_AnyPointerToBlockPointerCast,
131
132   /// \brief Converting between two Objective-C object types, which
133   /// can occur when performing reference binding to an Objective-C
134   /// object.
135   CK_ObjCObjectLValueCast,
136
137   /// \brief Floating point real to floating point complex
138   CK_FloatingRealToComplex,
139
140   /// \brief Floating pointer complex to floating point real
141   CK_FloatingComplexToReal,
142
143   /// \brief Converting a floating complex to bool
144   CK_FloatingComplexToBoolean,
145
146   /// \brief Casting between floating point complex types of different size
147   CK_FloatingComplexCast,
148
149   /// \brief Casting from a floating complex to an integral complex
150   CK_FloatingComplexToIntegralComplex,
151
152   /// \brief Integral real to integral complex
153   CK_IntegralRealToComplex,
154
155   /// \brief Integral complex to integral real
156   CK_IntegralComplexToReal,
157
158   /// \brief Converting an integral complex to bool
159   CK_IntegralComplexToBoolean,
160
161   /// \brief Casting between integral complex types of different size
162   CK_IntegralComplexCast,
163
164   /// \brief Casting from an integral complex to a floating complex
165   CK_IntegralComplexToFloatingComplex
166 };
167
168 #define CK_Invalid ((CastKind) -1)
169
170 enum BinaryOperatorKind {
171   // Operators listed in order of precedence.
172   // Note that additions to this should also update the StmtVisitor class.
173   BO_PtrMemD, BO_PtrMemI,       // [C++ 5.5] Pointer-to-member operators.
174   BO_Mul, BO_Div, BO_Rem,       // [C99 6.5.5] Multiplicative operators.
175   BO_Add, BO_Sub,               // [C99 6.5.6] Additive operators.
176   BO_Shl, BO_Shr,               // [C99 6.5.7] Bitwise shift operators.
177   BO_LT, BO_GT, BO_LE, BO_GE,   // [C99 6.5.8] Relational operators.
178   BO_EQ, BO_NE,                 // [C99 6.5.9] Equality operators.
179   BO_And,                       // [C99 6.5.10] Bitwise AND operator.
180   BO_Xor,                       // [C99 6.5.11] Bitwise XOR operator.
181   BO_Or,                        // [C99 6.5.12] Bitwise OR operator.
182   BO_LAnd,                      // [C99 6.5.13] Logical AND operator.
183   BO_LOr,                       // [C99 6.5.14] Logical OR operator.
184   BO_Assign, BO_MulAssign,      // [C99 6.5.16] Assignment operators.
185   BO_DivAssign, BO_RemAssign,
186   BO_AddAssign, BO_SubAssign,
187   BO_ShlAssign, BO_ShrAssign,
188   BO_AndAssign, BO_XorAssign,
189   BO_OrAssign,
190   BO_Comma                      // [C99 6.5.17] Comma operator.
191 };
192
193 enum UnaryOperatorKind {
194   // Note that additions to this should also update the StmtVisitor class.
195   UO_PostInc, UO_PostDec, // [C99 6.5.2.4] Postfix increment and decrement
196   UO_PreInc, UO_PreDec,   // [C99 6.5.3.1] Prefix increment and decrement
197   UO_AddrOf, UO_Deref,    // [C99 6.5.3.2] Address and indirection
198   UO_Plus, UO_Minus,      // [C99 6.5.3.3] Unary arithmetic
199   UO_Not, UO_LNot,        // [C99 6.5.3.3] Unary arithmetic
200   UO_Real, UO_Imag,       // "__real expr"/"__imag expr" Extension.
201   UO_Extension            // __extension__ marker.
202 };
203
204 }
205
206 #endif