Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | //===--- OperationKinds.def - Operations Database ---------------*- 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 | /// @file OperationKinds.def |
16 | /// |
17 | /// In this file, each of the C/C++ operations is enumerated CAST_OPERATION, |
18 | /// BINARY_OPERATION or UNARY_OPERATION macro, each of which can be specified by |
19 | /// the code including this file. |
20 | /// |
21 | /// Macros had one or two arguments: |
22 | /// |
23 | /// Name: The name of the operation. Name (prefixed with CK_, UO_ or BO_) will |
24 | /// be the name of the corresponding enumerator (see OperationsKinds.h). |
25 | /// |
26 | /// Spelling: A string that provides a canonical spelling for the operation. |
27 | |
28 | #ifndef CAST_OPERATION |
29 | # define CAST_OPERATION(Name) |
30 | #endif |
31 | |
32 | #ifndef BINARY_OPERATION |
33 | # define BINARY_OPERATION(Name, Spelling) |
34 | #endif |
35 | |
36 | #ifndef UNARY_OPERATION |
37 | # define UNARY_OPERATION(Name, Spelling) |
38 | #endif |
39 | |
40 | //===- Cast Operations ---------------------------------------------------===// |
41 | |
42 | /// CK_Dependent - A conversion which cannot yet be analyzed because |
43 | /// either the expression or target type is dependent. These are |
44 | /// created only for explicit casts; dependent ASTs aren't required |
45 | /// to even approximately type-check. |
46 | /// (T*) malloc(sizeof(T)) |
47 | /// reinterpret_cast<intptr_t>(A<T>::alloc()); |
48 | CAST_OPERATION(Dependent) |
49 | |
50 | /// CK_BitCast - A conversion which causes a bit pattern of one type |
51 | /// to be reinterpreted as a bit pattern of another type. Generally |
52 | /// the operands must have equivalent size and unrelated types. |
53 | /// |
54 | /// The pointer conversion char* -> int* is a bitcast. A conversion |
55 | /// from any pointer type to a C pointer type is a bitcast unless |
56 | /// it's actually BaseToDerived or DerivedToBase. A conversion to a |
57 | /// block pointer or ObjC pointer type is a bitcast only if the |
58 | /// operand has the same type kind; otherwise, it's one of the |
59 | /// specialized casts below. |
60 | /// |
61 | /// Vector coercions are bitcasts. |
62 | CAST_OPERATION(BitCast) |
63 | |
64 | /// CK_LValueBitCast - A conversion which reinterprets the address of |
65 | /// an l-value as an l-value of a different kind. Used for |
66 | /// reinterpret_casts of l-value expressions to reference types. |
67 | /// bool b; reinterpret_cast<char&>(b) = 'a'; |
68 | CAST_OPERATION(LValueBitCast) |
69 | |
70 | /// CK_LValueToRValue - A conversion which causes the extraction of |
71 | /// an r-value from the operand gl-value. The result of an r-value |
72 | /// conversion is always unqualified. |
73 | CAST_OPERATION(LValueToRValue) |
74 | |
75 | /// CK_NoOp - A conversion which does not affect the type other than |
76 | /// (possibly) adding qualifiers. |
77 | /// int -> int |
78 | /// char** -> const char * const * |
79 | CAST_OPERATION(NoOp) |
80 | |
81 | /// CK_BaseToDerived - A conversion from a C++ class pointer/reference |
82 | /// to a derived class pointer/reference. |
83 | /// B *b = static_cast<B*>(a); |
84 | CAST_OPERATION(BaseToDerived) |
85 | |
86 | /// CK_DerivedToBase - A conversion from a C++ class pointer |
87 | /// to a base class pointer. |
88 | /// A *a = new B(); |
89 | CAST_OPERATION(DerivedToBase) |
90 | |
91 | /// CK_UncheckedDerivedToBase - A conversion from a C++ class |
92 | /// pointer/reference to a base class that can assume that the |
93 | /// derived pointer is not null. |
94 | /// const A &a = B(); |
95 | /// b->method_from_a(); |
96 | CAST_OPERATION(UncheckedDerivedToBase) |
97 | |
98 | /// CK_Dynamic - A C++ dynamic_cast. |
99 | CAST_OPERATION(Dynamic) |
100 | |
101 | /// CK_ToUnion - The GCC cast-to-union extension. |
102 | /// int -> union { int x; float y; } |
103 | /// float -> union { int x; float y; } |
104 | CAST_OPERATION(ToUnion) |
105 | |
106 | /// CK_ArrayToPointerDecay - Array to pointer decay. |
107 | /// int[10] -> int* |
108 | /// char[5][6] -> char(*)[6] |
109 | CAST_OPERATION(ArrayToPointerDecay) |
110 | |
111 | /// CK_FunctionToPointerDecay - Function to pointer decay. |
112 | /// void(int) -> void(*)(int) |
113 | CAST_OPERATION(FunctionToPointerDecay) |
114 | |
115 | /// CK_NullToPointer - Null pointer constant to pointer, ObjC |
116 | /// pointer, or block pointer. |
117 | /// (void*) 0 |
118 | /// void (^block)() = 0; |
119 | CAST_OPERATION(NullToPointer) |
120 | |
121 | /// CK_NullToMemberPointer - Null pointer constant to member pointer. |
122 | /// int A::*mptr = 0; |
123 | /// int (A::*fptr)(int) = nullptr; |
124 | CAST_OPERATION(NullToMemberPointer) |
125 | |
126 | /// CK_BaseToDerivedMemberPointer - Member pointer in base class to |
127 | /// member pointer in derived class. |
128 | /// int B::*mptr = &A::member; |
129 | CAST_OPERATION(BaseToDerivedMemberPointer) |
130 | |
131 | /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to |
132 | /// member pointer in base class. |
133 | /// int A::*mptr = static_cast<int A::*>(&B::member); |
134 | CAST_OPERATION(DerivedToBaseMemberPointer) |
135 | |
136 | /// CK_MemberPointerToBoolean - Member pointer to boolean. A check |
137 | /// against the null member pointer. |
138 | CAST_OPERATION(MemberPointerToBoolean) |
139 | |
140 | /// CK_ReinterpretMemberPointer - Reinterpret a member pointer as a |
141 | /// different kind of member pointer. C++ forbids this from |
142 | /// crossing between function and object types, but otherwise does |
143 | /// not restrict it. However, the only operation that is permitted |
144 | /// on a "punned" member pointer is casting it back to the original |
145 | /// type, which is required to be a lossless operation (although |
146 | /// many ABIs do not guarantee this on all possible intermediate types). |
147 | CAST_OPERATION(ReinterpretMemberPointer) |
148 | |
149 | /// CK_UserDefinedConversion - Conversion using a user defined type |
150 | /// conversion function. |
151 | /// struct A { operator int(); }; int i = int(A()); |
152 | CAST_OPERATION(UserDefinedConversion) |
153 | |
154 | /// CK_ConstructorConversion - Conversion by constructor. |
155 | /// struct A { A(int); }; A a = A(10); |
156 | CAST_OPERATION(ConstructorConversion) |
157 | |
158 | /// CK_IntegralToPointer - Integral to pointer. A special kind of |
159 | /// reinterpreting conversion. Applies to normal, ObjC, and block |
160 | /// pointers. |
161 | /// (char*) 0x1001aab0 |
162 | /// reinterpret_cast<int*>(0) |
163 | CAST_OPERATION(IntegralToPointer) |
164 | |
165 | /// CK_PointerToIntegral - Pointer to integral. A special kind of |
166 | /// reinterpreting conversion. Applies to normal, ObjC, and block |
167 | /// pointers. |
168 | /// (intptr_t) "help!" |
169 | CAST_OPERATION(PointerToIntegral) |
170 | |
171 | /// CK_PointerToBoolean - Pointer to boolean conversion. A check |
172 | /// against null. Applies to normal, ObjC, and block pointers. |
173 | CAST_OPERATION(PointerToBoolean) |
174 | |
175 | /// CK_ToVoid - Cast to void, discarding the computed value. |
176 | /// (void) malloc(2048) |
177 | CAST_OPERATION(ToVoid) |
178 | |
179 | /// CK_VectorSplat - A conversion from an arithmetic type to a |
180 | /// vector of that element type. Fills all elements ("splats") with |
181 | /// the source value. |
182 | /// __attribute__((ext_vector_type(4))) int v = 5; |
183 | CAST_OPERATION(VectorSplat) |
184 | |
185 | /// CK_IntegralCast - A cast between integral types (other than to |
186 | /// boolean). Variously a bitcast, a truncation, a sign-extension, |
187 | /// or a zero-extension. |
188 | /// long l = 5; |
189 | /// (unsigned) i |
190 | CAST_OPERATION(IntegralCast) |
191 | |
192 | /// CK_IntegralToBoolean - Integral to boolean. A check against zero. |
193 | /// (bool) i |
194 | CAST_OPERATION(IntegralToBoolean) |
195 | |
196 | /// CK_IntegralToFloating - Integral to floating point. |
197 | /// float f = i; |
198 | CAST_OPERATION(IntegralToFloating) |
199 | |
200 | /// CK_FloatingToIntegral - Floating point to integral. Rounds |
201 | /// towards zero, discarding any fractional component. |
202 | /// (int) f |
203 | CAST_OPERATION(FloatingToIntegral) |
204 | |
205 | /// CK_FloatingToBoolean - Floating point to boolean. |
206 | /// (bool) f |
207 | CAST_OPERATION(FloatingToBoolean) |
208 | |
209 | // CK_BooleanToSignedIntegral - Convert a boolean to -1 or 0 for true and |
210 | // false, respectively. |
211 | CAST_OPERATION(BooleanToSignedIntegral) |
212 | |
213 | /// CK_FloatingCast - Casting between floating types of different size. |
214 | /// (double) f |
215 | /// (float) ld |
216 | CAST_OPERATION(FloatingCast) |
217 | |
218 | /// CK_CPointerToObjCPointerCast - Casting a C pointer kind to an |
219 | /// Objective-C pointer. |
220 | CAST_OPERATION(CPointerToObjCPointerCast) |
221 | |
222 | /// CK_BlockPointerToObjCPointerCast - Casting a block pointer to an |
223 | /// ObjC pointer. |
224 | CAST_OPERATION(BlockPointerToObjCPointerCast) |
225 | |
226 | /// CK_AnyPointerToBlockPointerCast - Casting any non-block pointer |
227 | /// to a block pointer. Block-to-block casts are bitcasts. |
228 | CAST_OPERATION(AnyPointerToBlockPointerCast) |
229 | |
230 | /// Converting between two Objective-C object types, which |
231 | /// can occur when performing reference binding to an Objective-C |
232 | /// object. |
233 | CAST_OPERATION(ObjCObjectLValueCast) |
234 | |
235 | /// A conversion of a floating point real to a floating point |
236 | /// complex of the original type. Injects the value as the real |
237 | /// component with a zero imaginary component. |
238 | /// float -> _Complex float |
239 | CAST_OPERATION(FloatingRealToComplex) |
240 | |
241 | /// Converts a floating point complex to floating point real |
242 | /// of the source's element type. Just discards the imaginary |
243 | /// component. |
244 | /// _Complex long double -> long double |
245 | CAST_OPERATION(FloatingComplexToReal) |
246 | |
247 | /// Converts a floating point complex to bool by comparing |
248 | /// against 0+0i. |
249 | CAST_OPERATION(FloatingComplexToBoolean) |
250 | |
251 | /// Converts between different floating point complex types. |
252 | /// _Complex float -> _Complex double |
253 | CAST_OPERATION(FloatingComplexCast) |
254 | |
255 | /// Converts from a floating complex to an integral complex. |
256 | /// _Complex float -> _Complex int |
257 | CAST_OPERATION(FloatingComplexToIntegralComplex) |
258 | |
259 | /// Converts from an integral real to an integral complex |
260 | /// whose element type matches the source. Injects the value as |
261 | /// the real component with a zero imaginary component. |
262 | /// long -> _Complex long |
263 | CAST_OPERATION(IntegralRealToComplex) |
264 | |
265 | /// Converts an integral complex to an integral real of the |
266 | /// source's element type by discarding the imaginary component. |
267 | /// _Complex short -> short |
268 | CAST_OPERATION(IntegralComplexToReal) |
269 | |
270 | /// Converts an integral complex to bool by comparing against |
271 | /// 0+0i. |
272 | CAST_OPERATION(IntegralComplexToBoolean) |
273 | |
274 | /// Converts between different integral complex types. |
275 | /// _Complex char -> _Complex long long |
276 | /// _Complex unsigned int -> _Complex signed int |
277 | CAST_OPERATION(IntegralComplexCast) |
278 | |
279 | /// Converts from an integral complex to a floating complex. |
280 | /// _Complex unsigned -> _Complex float |
281 | CAST_OPERATION(IntegralComplexToFloatingComplex) |
282 | |
283 | /// [ARC] Produces a retainable object pointer so that it may |
284 | /// be consumed, e.g. by being passed to a consuming parameter. |
285 | /// Calls objc_retain. |
286 | CAST_OPERATION(ARCProduceObject) |
287 | |
288 | /// [ARC] Consumes a retainable object pointer that has just |
289 | /// been produced, e.g. as the return value of a retaining call. |
290 | /// Enters a cleanup to call objc_release at some indefinite time. |
291 | CAST_OPERATION(ARCConsumeObject) |
292 | |
293 | /// [ARC] Reclaim a retainable object pointer object that may |
294 | /// have been produced and autoreleased as part of a function return |
295 | /// sequence. |
296 | CAST_OPERATION(ARCReclaimReturnedObject) |
297 | |
298 | /// [ARC] Causes a value of block type to be copied to the |
299 | /// heap, if it is not already there. A number of other operations |
300 | /// in ARC cause blocks to be copied; this is for cases where that |
301 | /// would not otherwise be guaranteed, such as when casting to a |
302 | /// non-block pointer type. |
303 | CAST_OPERATION(ARCExtendBlockObject) |
304 | |
305 | /// Converts from _Atomic(T) to T. |
306 | CAST_OPERATION(AtomicToNonAtomic) |
307 | /// Converts from T to _Atomic(T). |
308 | CAST_OPERATION(NonAtomicToAtomic) |
309 | |
310 | /// Causes a block literal to by copied to the heap and then |
311 | /// autoreleased. |
312 | /// |
313 | /// This particular cast kind is used for the conversion from a C++11 |
314 | /// lambda expression to a block pointer. |
315 | CAST_OPERATION(CopyAndAutoreleaseBlockObject) |
316 | |
317 | // Convert a builtin function to a function pointer; only allowed in the |
318 | // callee of a call expression. |
319 | CAST_OPERATION(BuiltinFnToFnPtr) |
320 | |
321 | // Convert a zero value for OpenCL event_t initialization. |
322 | CAST_OPERATION(ZeroToOCLEvent) |
323 | |
324 | // Convert a zero value for OpenCL queue_t initialization. |
325 | CAST_OPERATION(ZeroToOCLQueue) |
326 | |
327 | // Convert a pointer to a different address space. |
328 | CAST_OPERATION(AddressSpaceConversion) |
329 | |
330 | // Convert an integer initializer to an OpenCL sampler. |
331 | CAST_OPERATION(IntToOCLSampler) |
332 | |
333 | //===- Binary Operations -------------------------------------------------===// |
334 | // Operators listed in order of precedence. |
335 | // Note that additions to this should also update the StmtVisitor class and |
336 | // BinaryOperator::getOverloadedOperator. |
337 | |
338 | // [C++ 5.5] Pointer-to-member operators. |
339 | BINARY_OPERATION(PtrMemD, ".*") |
340 | BINARY_OPERATION(PtrMemI, "->*") |
341 | // [C99 6.5.5] Multiplicative operators. |
342 | BINARY_OPERATION(Mul, "*") |
343 | BINARY_OPERATION(Div, "/") |
344 | BINARY_OPERATION(Rem, "%") |
345 | // [C99 6.5.6] Additive operators. |
346 | BINARY_OPERATION(Add, "+") |
347 | BINARY_OPERATION(Sub, "-") |
348 | // [C99 6.5.7] Bitwise shift operators. |
349 | BINARY_OPERATION(Shl, "<<") |
350 | BINARY_OPERATION(Shr, ">>") |
351 | // C++20 [expr.spaceship] Three-way comparison operator. |
352 | BINARY_OPERATION(Cmp, "<=>") |
353 | // [C99 6.5.8] Relational operators. |
354 | BINARY_OPERATION(LT, "<") |
355 | BINARY_OPERATION(GT, ">") |
356 | BINARY_OPERATION(LE, "<=") |
357 | BINARY_OPERATION(GE, ">=") |
358 | // [C99 6.5.9] Equality operators. |
359 | BINARY_OPERATION(EQ, "==") |
360 | BINARY_OPERATION(NE, "!=") |
361 | // [C99 6.5.10] Bitwise AND operator. |
362 | BINARY_OPERATION(And, "&") |
363 | // [C99 6.5.11] Bitwise XOR operator. |
364 | BINARY_OPERATION(Xor, "^") |
365 | // [C99 6.5.12] Bitwise OR operator. |
366 | BINARY_OPERATION(Or, "|") |
367 | // [C99 6.5.13] Logical AND operator. |
368 | BINARY_OPERATION(LAnd, "&&") |
369 | // [C99 6.5.14] Logical OR operator. |
370 | BINARY_OPERATION(LOr, "||") |
371 | // [C99 6.5.16] Assignment operators. |
372 | BINARY_OPERATION(Assign, "=") |
373 | BINARY_OPERATION(MulAssign, "*=") |
374 | BINARY_OPERATION(DivAssign, "/=") |
375 | BINARY_OPERATION(RemAssign, "%=") |
376 | BINARY_OPERATION(AddAssign, "+=") |
377 | BINARY_OPERATION(SubAssign, "-=") |
378 | BINARY_OPERATION(ShlAssign, "<<=") |
379 | BINARY_OPERATION(ShrAssign, ">>=") |
380 | BINARY_OPERATION(AndAssign, "&=") |
381 | BINARY_OPERATION(XorAssign, "^=") |
382 | BINARY_OPERATION(OrAssign, "|=") |
383 | // [C99 6.5.17] Comma operator. |
384 | BINARY_OPERATION(Comma, ",") |
385 | |
386 | |
387 | //===- Unary Operations ---------------------------------------------------===// |
388 | // Note that additions to this should also update the StmtVisitor class and |
389 | // UnaryOperator::getOverloadedOperator. |
390 | |
391 | // [C99 6.5.2.4] Postfix increment and decrement |
392 | UNARY_OPERATION(PostInc, "++") |
393 | UNARY_OPERATION(PostDec, "--") |
394 | // [C99 6.5.3.1] Prefix increment and decrement |
395 | UNARY_OPERATION(PreInc, "++") |
396 | UNARY_OPERATION(PreDec, "--") |
397 | // [C99 6.5.3.2] Address and indirection |
398 | UNARY_OPERATION(AddrOf, "&") |
399 | UNARY_OPERATION(Deref, "*") |
400 | // [C99 6.5.3.3] Unary arithmetic |
401 | UNARY_OPERATION(Plus, "+") |
402 | UNARY_OPERATION(Minus, "-") |
403 | UNARY_OPERATION(Not, "~") |
404 | UNARY_OPERATION(LNot, "!") |
405 | // "__real expr"/"__imag expr" Extension. |
406 | UNARY_OPERATION(Real, "__real") |
407 | UNARY_OPERATION(Imag, "__imag") |
408 | // __extension__ marker. |
409 | UNARY_OPERATION(Extension, "__extension__") |
410 | // [C++ Coroutines] co_await operator |
411 | UNARY_OPERATION(Coawait, "co_await") |
412 | |
413 | #undef CAST_OPERATION |
414 | #undef BINARY_OPERATION |
415 | #undef UNARY_OPERATION |
416 |
Warning: That file was not part of the compilation database. It may have many parsing errors.