Coverage Report

Created: 2019-07-24 05:18

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