1 //===- OperationKinds.h - Operation enums -----------------------*- 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 enumerates the different kinds of operations that can be
11 // performed by various expressions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_AST_OPERATION_KINDS_H
16 #define LLVM_CLANG_AST_OPERATION_KINDS_H
20 /// CastKind - the kind of cast this represents.
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
28 /// CK_Dependent - This explicit cast cannot yet be analyzed because
29 /// the type or expression is dependent.
32 /// CK_BitCast - Used for reinterpret_cast.
35 /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
39 /// CK_NoOp - Used for const_cast.
42 /// CK_BaseToDerived - Base to derived class casts.
45 /// CK_DerivedToBase - Derived to base class casts.
48 /// CK_UncheckedDerivedToBase - Derived to base class casts that
49 /// assume that the derived pointer is not null.
50 CK_UncheckedDerivedToBase,
52 /// CK_Dynamic - Dynamic cast.
55 /// CK_ToUnion - Cast to union (GCC extension).
58 /// CK_ArrayToPointerDecay - Array to pointer decay.
59 CK_ArrayToPointerDecay,
61 /// CK_FunctionToPointerDecay - Function to pointer decay.
62 CK_FunctionToPointerDecay,
64 /// CK_NullToPointer - Null pointer to pointer.
67 /// CK_NullToMemberPointer - Null pointer to member pointer.
68 CK_NullToMemberPointer,
70 /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
71 /// member pointer in derived class.
72 CK_BaseToDerivedMemberPointer,
74 /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
75 /// member pointer in base class.
76 CK_DerivedToBaseMemberPointer,
78 /// CK_UserDefinedConversion - Conversion using a user defined type
79 /// conversion function.
80 CK_UserDefinedConversion,
82 /// CK_ConstructorConversion - Conversion by constructor
83 CK_ConstructorConversion,
85 /// CK_IntegralToPointer - Integral to pointer
88 /// CK_PointerToIntegral - Pointer to integral
91 /// CK_PointerToBoolean - Pointer to boolean (i.e. is not null)
94 /// CK_ToVoid - Cast to void.
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.
102 /// CK_IntegralCast - A truncating or extending cast between integral
103 /// types of different size.
106 /// CK_IntegralToBoolean - Integral to boolean.
107 CK_IntegralToBoolean,
109 /// CK_IntegralToFloating - Integral to floating point.
110 CK_IntegralToFloating,
112 /// CK_FloatingToIntegral - Floating point to integral.
113 CK_FloatingToIntegral,
115 /// CK_FloatingToBoolean - Floating point to boolean.
116 CK_FloatingToBoolean,
118 /// CK_FloatingCast - Casting between floating types of different size.
121 /// CK_MemberPointerToBoolean - Member pointer to boolean
122 CK_MemberPointerToBoolean,
124 /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
126 CK_AnyPointerToObjCPointerCast,
128 /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
130 CK_AnyPointerToBlockPointerCast,
132 /// \brief Converting between two Objective-C object types, which
133 /// can occur when performing reference binding to an Objective-C
135 CK_ObjCObjectLValueCast,
137 /// \brief Floating point real to floating point complex
138 CK_FloatingRealToComplex,
140 /// \brief Floating pointer complex to floating point real
141 CK_FloatingComplexToReal,
143 /// \brief Converting a floating complex to bool
144 CK_FloatingComplexToBoolean,
146 /// \brief Casting between floating point complex types of different size
147 CK_FloatingComplexCast,
149 /// \brief Casting from a floating complex to an integral complex
150 CK_FloatingComplexToIntegralComplex,
152 /// \brief Integral real to integral complex
153 CK_IntegralRealToComplex,
155 /// \brief Integral complex to integral real
156 CK_IntegralComplexToReal,
158 /// \brief Converting an integral complex to bool
159 CK_IntegralComplexToBoolean,
161 /// \brief Casting between integral complex types of different size
162 CK_IntegralComplexCast,
164 /// \brief Casting from an integral complex to a floating complex
165 CK_IntegralComplexToFloatingComplex
168 #define CK_Invalid ((CastKind) -1)
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,
190 BO_Comma // [C99 6.5.17] Comma operator.
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.