Coverage Report

Created: 2017-10-03 07:32

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