OperationKinds.h revision 404cd1669c3ba138a9ae0a619bd689cce5aae271
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
18namespace clang {
19
20/// CastKind - the kind of cast this represents.
21enum 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_BitCast - Used for reinterpret_cast.
29  CK_BitCast,
30
31  /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
32  /// a reference type.
33  CK_LValueBitCast,
34
35  /// CK_NoOp - Used for const_cast.
36  CK_NoOp,
37
38  /// CK_BaseToDerived - Base to derived class casts.
39  CK_BaseToDerived,
40
41  /// CK_DerivedToBase - Derived to base class casts.
42  CK_DerivedToBase,
43
44  /// CK_UncheckedDerivedToBase - Derived to base class casts that
45  /// assume that the derived pointer is not null.
46  CK_UncheckedDerivedToBase,
47
48  /// CK_Dynamic - Dynamic cast.
49  CK_Dynamic,
50
51  /// CK_ToUnion - Cast to union (GCC extension).
52  CK_ToUnion,
53
54  /// CK_ArrayToPointerDecay - Array to pointer decay.
55  CK_ArrayToPointerDecay,
56
57  /// CK_FunctionToPointerDecay - Function to pointer decay.
58  CK_FunctionToPointerDecay,
59
60  /// CK_NullToPointer - Null pointer to pointer.
61  CK_NullToPointer,
62
63  /// CK_NullToMemberPointer - Null pointer to member pointer.
64  CK_NullToMemberPointer,
65
66  /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
67  /// member pointer in derived class.
68  CK_BaseToDerivedMemberPointer,
69
70  /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
71  /// member pointer in base class.
72  CK_DerivedToBaseMemberPointer,
73
74  /// CK_UserDefinedConversion - Conversion using a user defined type
75  /// conversion function.
76  CK_UserDefinedConversion,
77
78  /// CK_ConstructorConversion - Conversion by constructor
79  CK_ConstructorConversion,
80
81  /// CK_IntegralToPointer - Integral to pointer
82  CK_IntegralToPointer,
83
84  /// CK_PointerToIntegral - Pointer to integral
85  CK_PointerToIntegral,
86
87  /// CK_ToVoid - Cast to void.
88  CK_ToVoid,
89
90  /// CK_VectorSplat - Casting from an integer/floating type to an extended
91  /// vector type with the same element type as the src type. Splats the
92  /// src expression into the destination expression.
93  CK_VectorSplat,
94
95  /// CK_IntegralCast - Casting between integral types of different size.
96  CK_IntegralCast,
97
98  /// CK_IntegralToFloating - Integral to floating point.
99  CK_IntegralToFloating,
100
101  /// CK_FloatingToIntegral - Floating point to integral.
102  CK_FloatingToIntegral,
103
104  /// CK_FloatingCast - Casting between floating types of different size.
105  CK_FloatingCast,
106
107  /// CK_MemberPointerToBoolean - Member pointer to boolean
108  CK_MemberPointerToBoolean,
109
110  /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
111  /// pointer
112  CK_AnyPointerToObjCPointerCast,
113
114  /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
115  /// pointer
116  CK_AnyPointerToBlockPointerCast,
117
118  /// \brief Converting between two Objective-C object types, which
119  /// can occur when performing reference binding to an Objective-C
120  /// object.
121  CK_ObjCObjectLValueCast
122};
123
124
125enum BinaryOperatorKind {
126  // Operators listed in order of precedence.
127  // Note that additions to this should also update the StmtVisitor class.
128  BO_PtrMemD, BO_PtrMemI,       // [C++ 5.5] Pointer-to-member operators.
129  BO_Mul, BO_Div, BO_Rem,       // [C99 6.5.5] Multiplicative operators.
130  BO_Add, BO_Sub,               // [C99 6.5.6] Additive operators.
131  BO_Shl, BO_Shr,               // [C99 6.5.7] Bitwise shift operators.
132  BO_LT, BO_GT, BO_LE, BO_GE,   // [C99 6.5.8] Relational operators.
133  BO_EQ, BO_NE,                 // [C99 6.5.9] Equality operators.
134  BO_And,                       // [C99 6.5.10] Bitwise AND operator.
135  BO_Xor,                       // [C99 6.5.11] Bitwise XOR operator.
136  BO_Or,                        // [C99 6.5.12] Bitwise OR operator.
137  BO_LAnd,                      // [C99 6.5.13] Logical AND operator.
138  BO_LOr,                       // [C99 6.5.14] Logical OR operator.
139  BO_Assign, BO_MulAssign,      // [C99 6.5.16] Assignment operators.
140  BO_DivAssign, BO_RemAssign,
141  BO_AddAssign, BO_SubAssign,
142  BO_ShlAssign, BO_ShrAssign,
143  BO_AndAssign, BO_XorAssign,
144  BO_OrAssign,
145  BO_Comma                      // [C99 6.5.17] Comma operator.
146};
147
148enum UnaryOperatorKind {
149  // Note that additions to this should also update the StmtVisitor class.
150  UO_PostInc, UO_PostDec, // [C99 6.5.2.4] Postfix increment and decrement
151  UO_PreInc, UO_PreDec,   // [C99 6.5.3.1] Prefix increment and decrement
152  UO_AddrOf, UO_Deref,    // [C99 6.5.3.2] Address and indirection
153  UO_Plus, UO_Minus,      // [C99 6.5.3.3] Unary arithmetic
154  UO_Not, UO_LNot,        // [C99 6.5.3.3] Unary arithmetic
155  UO_Real, UO_Imag,       // "__real expr"/"__imag expr" Extension.
156  UO_Extension            // __extension__ marker.
157};
158
159}
160
161#endif
162