10b57cec5SDimitry Andric//===--- OperationKinds.def - Operations Database ---------------*- C++ -*-===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric// 90b57cec5SDimitry Andric// This file enumerates the different kinds of operations that can be 100b57cec5SDimitry Andric// performed by various expressions. 110b57cec5SDimitry Andric// 120b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric// 140b57cec5SDimitry Andric/// @file OperationKinds.def 150b57cec5SDimitry Andric/// 160b57cec5SDimitry Andric/// In this file, each of the C/C++ operations is enumerated CAST_OPERATION, 170b57cec5SDimitry Andric/// BINARY_OPERATION or UNARY_OPERATION macro, each of which can be specified by 180b57cec5SDimitry Andric/// the code including this file. 190b57cec5SDimitry Andric/// 200b57cec5SDimitry Andric/// Macros had one or two arguments: 210b57cec5SDimitry Andric/// 220b57cec5SDimitry Andric/// Name: The name of the operation. Name (prefixed with CK_, UO_ or BO_) will 230b57cec5SDimitry Andric/// be the name of the corresponding enumerator (see OperationsKinds.h). 240b57cec5SDimitry Andric/// 250b57cec5SDimitry Andric/// Spelling: A string that provides a canonical spelling for the operation. 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric#ifndef CAST_OPERATION 280b57cec5SDimitry Andric# define CAST_OPERATION(Name) 290b57cec5SDimitry Andric#endif 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric#ifndef BINARY_OPERATION 320b57cec5SDimitry Andric# define BINARY_OPERATION(Name, Spelling) 330b57cec5SDimitry Andric#endif 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric#ifndef UNARY_OPERATION 360b57cec5SDimitry Andric# define UNARY_OPERATION(Name, Spelling) 370b57cec5SDimitry Andric#endif 380b57cec5SDimitry Andric 390b57cec5SDimitry Andric//===- Cast Operations ---------------------------------------------------===// 400b57cec5SDimitry Andric 410b57cec5SDimitry Andric/// CK_Dependent - A conversion which cannot yet be analyzed because 420b57cec5SDimitry Andric/// either the expression or target type is dependent. These are 430b57cec5SDimitry Andric/// created only for explicit casts; dependent ASTs aren't required 440b57cec5SDimitry Andric/// to even approximately type-check. 450b57cec5SDimitry Andric/// (T*) malloc(sizeof(T)) 460b57cec5SDimitry Andric/// reinterpret_cast<intptr_t>(A<T>::alloc()); 470b57cec5SDimitry AndricCAST_OPERATION(Dependent) 480b57cec5SDimitry Andric 490b57cec5SDimitry Andric/// CK_BitCast - A conversion which causes a bit pattern of one type 500b57cec5SDimitry Andric/// to be reinterpreted as a bit pattern of another type. Generally 510b57cec5SDimitry Andric/// the operands must have equivalent size and unrelated types. 520b57cec5SDimitry Andric/// 530b57cec5SDimitry Andric/// The pointer conversion char* -> int* is a bitcast. A conversion 540b57cec5SDimitry Andric/// from any pointer type to a C pointer type is a bitcast unless 550b57cec5SDimitry Andric/// it's actually BaseToDerived or DerivedToBase. A conversion to a 560b57cec5SDimitry Andric/// block pointer or ObjC pointer type is a bitcast only if the 570b57cec5SDimitry Andric/// operand has the same type kind; otherwise, it's one of the 580b57cec5SDimitry Andric/// specialized casts below. 590b57cec5SDimitry Andric/// 600b57cec5SDimitry Andric/// Vector coercions are bitcasts. 610b57cec5SDimitry AndricCAST_OPERATION(BitCast) 620b57cec5SDimitry Andric 630b57cec5SDimitry Andric/// CK_LValueBitCast - A conversion which reinterprets the address of 640b57cec5SDimitry Andric/// an l-value as an l-value of a different kind. Used for 650b57cec5SDimitry Andric/// reinterpret_casts of l-value expressions to reference types. 660b57cec5SDimitry Andric/// bool b; reinterpret_cast<char&>(b) = 'a'; 670b57cec5SDimitry AndricCAST_OPERATION(LValueBitCast) 680b57cec5SDimitry Andric 69a7dea167SDimitry Andric/// CK_LValueToRValueBitCast - A conversion that causes us to reinterpret the 70a7dea167SDimitry Andric/// object representation of an lvalue as an rvalue. Created by 71a7dea167SDimitry Andric/// __builtin_bit_cast. 720b57cec5SDimitry AndricCAST_OPERATION(LValueToRValueBitCast) 730b57cec5SDimitry Andric 740b57cec5SDimitry Andric/// CK_LValueToRValue - A conversion which causes the extraction of 750b57cec5SDimitry Andric/// an r-value from the operand gl-value. The result of an r-value 760b57cec5SDimitry Andric/// conversion is always unqualified. 770b57cec5SDimitry AndricCAST_OPERATION(LValueToRValue) 780b57cec5SDimitry Andric 790b57cec5SDimitry Andric/// CK_NoOp - A conversion which does not affect the type other than 80e8d8bef9SDimitry Andric/// (possibly) adding qualifiers or removing noexcept. 810b57cec5SDimitry Andric/// int -> int 820b57cec5SDimitry Andric/// char** -> const char * const * 835f757f3fSDimitry Andric/// int[1] -> int[] 84e8d8bef9SDimitry Andric/// void () noexcept -> void () 850b57cec5SDimitry AndricCAST_OPERATION(NoOp) 860b57cec5SDimitry Andric 870b57cec5SDimitry Andric/// CK_BaseToDerived - A conversion from a C++ class pointer/reference 880b57cec5SDimitry Andric/// to a derived class pointer/reference. 890b57cec5SDimitry Andric/// B *b = static_cast<B*>(a); 900b57cec5SDimitry AndricCAST_OPERATION(BaseToDerived) 910b57cec5SDimitry Andric 920b57cec5SDimitry Andric/// CK_DerivedToBase - A conversion from a C++ class pointer 930b57cec5SDimitry Andric/// to a base class pointer. 940b57cec5SDimitry Andric/// A *a = new B(); 950b57cec5SDimitry AndricCAST_OPERATION(DerivedToBase) 960b57cec5SDimitry Andric 970b57cec5SDimitry Andric/// CK_UncheckedDerivedToBase - A conversion from a C++ class 980b57cec5SDimitry Andric/// pointer/reference to a base class that can assume that the 990b57cec5SDimitry Andric/// derived pointer is not null. 1000b57cec5SDimitry Andric/// const A &a = B(); 1010b57cec5SDimitry Andric/// b->method_from_a(); 1020b57cec5SDimitry AndricCAST_OPERATION(UncheckedDerivedToBase) 1030b57cec5SDimitry Andric 1040b57cec5SDimitry Andric/// CK_Dynamic - A C++ dynamic_cast. 1050b57cec5SDimitry AndricCAST_OPERATION(Dynamic) 1060b57cec5SDimitry Andric 1070b57cec5SDimitry Andric/// CK_ToUnion - The GCC cast-to-union extension. 1080b57cec5SDimitry Andric/// int -> union { int x; float y; } 1090b57cec5SDimitry Andric/// float -> union { int x; float y; } 1100b57cec5SDimitry AndricCAST_OPERATION(ToUnion) 1110b57cec5SDimitry Andric 1120b57cec5SDimitry Andric/// CK_ArrayToPointerDecay - Array to pointer decay. 1130b57cec5SDimitry Andric/// int[10] -> int* 1140b57cec5SDimitry Andric/// char[5][6] -> char(*)[6] 1150b57cec5SDimitry AndricCAST_OPERATION(ArrayToPointerDecay) 1160b57cec5SDimitry Andric 1170b57cec5SDimitry Andric/// CK_FunctionToPointerDecay - Function to pointer decay. 1180b57cec5SDimitry Andric/// void(int) -> void(*)(int) 1190b57cec5SDimitry AndricCAST_OPERATION(FunctionToPointerDecay) 1200b57cec5SDimitry Andric 1210b57cec5SDimitry Andric/// CK_NullToPointer - Null pointer constant to pointer, ObjC 1220b57cec5SDimitry Andric/// pointer, or block pointer. 1230b57cec5SDimitry Andric/// (void*) 0 1240b57cec5SDimitry Andric/// void (^block)() = 0; 1250b57cec5SDimitry AndricCAST_OPERATION(NullToPointer) 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric/// CK_NullToMemberPointer - Null pointer constant to member pointer. 1280b57cec5SDimitry Andric/// int A::*mptr = 0; 1290b57cec5SDimitry Andric/// int (A::*fptr)(int) = nullptr; 1300b57cec5SDimitry AndricCAST_OPERATION(NullToMemberPointer) 1310b57cec5SDimitry Andric 1320b57cec5SDimitry Andric/// CK_BaseToDerivedMemberPointer - Member pointer in base class to 1330b57cec5SDimitry Andric/// member pointer in derived class. 1340b57cec5SDimitry Andric/// int B::*mptr = &A::member; 1350b57cec5SDimitry AndricCAST_OPERATION(BaseToDerivedMemberPointer) 1360b57cec5SDimitry Andric 1370b57cec5SDimitry Andric/// CK_DerivedToBaseMemberPointer - Member pointer in derived class to 1380b57cec5SDimitry Andric/// member pointer in base class. 1390b57cec5SDimitry Andric/// int A::*mptr = static_cast<int A::*>(&B::member); 1400b57cec5SDimitry AndricCAST_OPERATION(DerivedToBaseMemberPointer) 1410b57cec5SDimitry Andric 1420b57cec5SDimitry Andric/// CK_MemberPointerToBoolean - Member pointer to boolean. A check 1430b57cec5SDimitry Andric/// against the null member pointer. 1440b57cec5SDimitry AndricCAST_OPERATION(MemberPointerToBoolean) 1450b57cec5SDimitry Andric 1460b57cec5SDimitry Andric/// CK_ReinterpretMemberPointer - Reinterpret a member pointer as a 1470b57cec5SDimitry Andric/// different kind of member pointer. C++ forbids this from 1480b57cec5SDimitry Andric/// crossing between function and object types, but otherwise does 1490b57cec5SDimitry Andric/// not restrict it. However, the only operation that is permitted 1500b57cec5SDimitry Andric/// on a "punned" member pointer is casting it back to the original 1510b57cec5SDimitry Andric/// type, which is required to be a lossless operation (although 1520b57cec5SDimitry Andric/// many ABIs do not guarantee this on all possible intermediate types). 1530b57cec5SDimitry AndricCAST_OPERATION(ReinterpretMemberPointer) 1540b57cec5SDimitry Andric 1550b57cec5SDimitry Andric/// CK_UserDefinedConversion - Conversion using a user defined type 1560b57cec5SDimitry Andric/// conversion function. 1570b57cec5SDimitry Andric/// struct A { operator int(); }; int i = int(A()); 1580b57cec5SDimitry AndricCAST_OPERATION(UserDefinedConversion) 1590b57cec5SDimitry Andric 1600b57cec5SDimitry Andric/// CK_ConstructorConversion - Conversion by constructor. 1610b57cec5SDimitry Andric/// struct A { A(int); }; A a = A(10); 1620b57cec5SDimitry AndricCAST_OPERATION(ConstructorConversion) 1630b57cec5SDimitry Andric 1640b57cec5SDimitry Andric/// CK_IntegralToPointer - Integral to pointer. A special kind of 1650b57cec5SDimitry Andric/// reinterpreting conversion. Applies to normal, ObjC, and block 1660b57cec5SDimitry Andric/// pointers. 1670b57cec5SDimitry Andric/// (char*) 0x1001aab0 1680b57cec5SDimitry Andric/// reinterpret_cast<int*>(0) 1690b57cec5SDimitry AndricCAST_OPERATION(IntegralToPointer) 1700b57cec5SDimitry Andric 1710b57cec5SDimitry Andric/// CK_PointerToIntegral - Pointer to integral. A special kind of 1720b57cec5SDimitry Andric/// reinterpreting conversion. Applies to normal, ObjC, and block 1730b57cec5SDimitry Andric/// pointers. 1740b57cec5SDimitry Andric/// (intptr_t) "help!" 1750b57cec5SDimitry AndricCAST_OPERATION(PointerToIntegral) 1760b57cec5SDimitry Andric 1770b57cec5SDimitry Andric/// CK_PointerToBoolean - Pointer to boolean conversion. A check 1780b57cec5SDimitry Andric/// against null. Applies to normal, ObjC, and block pointers. 1790b57cec5SDimitry AndricCAST_OPERATION(PointerToBoolean) 1800b57cec5SDimitry Andric 1810b57cec5SDimitry Andric/// CK_ToVoid - Cast to void, discarding the computed value. 1820b57cec5SDimitry Andric/// (void) malloc(2048) 1830b57cec5SDimitry AndricCAST_OPERATION(ToVoid) 1840b57cec5SDimitry Andric 185fe6060f1SDimitry Andric/// CK_MatrixCast - A cast between matrix types of the same dimensions. 186fe6060f1SDimitry AndricCAST_OPERATION(MatrixCast) 187fe6060f1SDimitry Andric 1880b57cec5SDimitry Andric/// CK_VectorSplat - A conversion from an arithmetic type to a 1890b57cec5SDimitry Andric/// vector of that element type. Fills all elements ("splats") with 1900b57cec5SDimitry Andric/// the source value. 1910b57cec5SDimitry Andric/// __attribute__((ext_vector_type(4))) int v = 5; 1920b57cec5SDimitry AndricCAST_OPERATION(VectorSplat) 1930b57cec5SDimitry Andric 1940b57cec5SDimitry Andric/// CK_IntegralCast - A cast between integral types (other than to 1950b57cec5SDimitry Andric/// boolean). Variously a bitcast, a truncation, a sign-extension, 1960b57cec5SDimitry Andric/// or a zero-extension. 1970b57cec5SDimitry Andric/// long l = 5; 1980b57cec5SDimitry Andric/// (unsigned) i 1990b57cec5SDimitry AndricCAST_OPERATION(IntegralCast) 2000b57cec5SDimitry Andric 2010b57cec5SDimitry Andric/// CK_IntegralToBoolean - Integral to boolean. A check against zero. 2020b57cec5SDimitry Andric/// (bool) i 2030b57cec5SDimitry AndricCAST_OPERATION(IntegralToBoolean) 2040b57cec5SDimitry Andric 2050b57cec5SDimitry Andric/// CK_IntegralToFloating - Integral to floating point. 2060b57cec5SDimitry Andric/// float f = i; 2070b57cec5SDimitry AndricCAST_OPERATION(IntegralToFloating) 2080b57cec5SDimitry Andric 209e8d8bef9SDimitry Andric/// CK_FloatingToFixedPoint - Floating to fixed point. 210e8d8bef9SDimitry Andric/// _Accum a = f; 211e8d8bef9SDimitry AndricCAST_OPERATION(FloatingToFixedPoint) 212e8d8bef9SDimitry Andric 213e8d8bef9SDimitry Andric/// CK_FixedPointToFloating - Fixed point to floating. 214e8d8bef9SDimitry Andric/// (float) 2.5k 215e8d8bef9SDimitry AndricCAST_OPERATION(FixedPointToFloating) 216e8d8bef9SDimitry Andric 2170b57cec5SDimitry Andric/// CK_FixedPointCast - Fixed point to fixed point. 2180b57cec5SDimitry Andric/// (_Accum) 0.5r 2190b57cec5SDimitry AndricCAST_OPERATION(FixedPointCast) 2200b57cec5SDimitry Andric 2210b57cec5SDimitry Andric/// CK_FixedPointToIntegral - Fixed point to integral. 2220b57cec5SDimitry Andric/// (int) 2.0k 2230b57cec5SDimitry AndricCAST_OPERATION(FixedPointToIntegral) 2240b57cec5SDimitry Andric 2250b57cec5SDimitry Andric/// CK_IntegralToFixedPoint - Integral to a fixed point. 2260b57cec5SDimitry Andric/// (_Accum) 2 2270b57cec5SDimitry AndricCAST_OPERATION(IntegralToFixedPoint) 2280b57cec5SDimitry Andric 2290b57cec5SDimitry Andric/// CK_FixedPointToBoolean - Fixed point to boolean. 2300b57cec5SDimitry Andric/// (bool) 0.5r 2310b57cec5SDimitry AndricCAST_OPERATION(FixedPointToBoolean) 2320b57cec5SDimitry Andric 2330b57cec5SDimitry Andric/// CK_FloatingToIntegral - Floating point to integral. Rounds 2340b57cec5SDimitry Andric/// towards zero, discarding any fractional component. 2350b57cec5SDimitry Andric/// (int) f 2360b57cec5SDimitry AndricCAST_OPERATION(FloatingToIntegral) 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andric/// CK_FloatingToBoolean - Floating point to boolean. 2390b57cec5SDimitry Andric/// (bool) f 2400b57cec5SDimitry AndricCAST_OPERATION(FloatingToBoolean) 2410b57cec5SDimitry Andric 2420b57cec5SDimitry Andric// CK_BooleanToSignedIntegral - Convert a boolean to -1 or 0 for true and 2430b57cec5SDimitry Andric// false, respectively. 2440b57cec5SDimitry AndricCAST_OPERATION(BooleanToSignedIntegral) 2450b57cec5SDimitry Andric 2460b57cec5SDimitry Andric/// CK_FloatingCast - Casting between floating types of different size. 2470b57cec5SDimitry Andric/// (double) f 2480b57cec5SDimitry Andric/// (float) ld 2490b57cec5SDimitry AndricCAST_OPERATION(FloatingCast) 2500b57cec5SDimitry Andric 2510b57cec5SDimitry Andric/// CK_CPointerToObjCPointerCast - Casting a C pointer kind to an 2520b57cec5SDimitry Andric/// Objective-C pointer. 2530b57cec5SDimitry AndricCAST_OPERATION(CPointerToObjCPointerCast) 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric/// CK_BlockPointerToObjCPointerCast - Casting a block pointer to an 2560b57cec5SDimitry Andric/// ObjC pointer. 2570b57cec5SDimitry AndricCAST_OPERATION(BlockPointerToObjCPointerCast) 2580b57cec5SDimitry Andric 2590b57cec5SDimitry Andric/// CK_AnyPointerToBlockPointerCast - Casting any non-block pointer 2600b57cec5SDimitry Andric/// to a block pointer. Block-to-block casts are bitcasts. 2610b57cec5SDimitry AndricCAST_OPERATION(AnyPointerToBlockPointerCast) 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric/// Converting between two Objective-C object types, which 2640b57cec5SDimitry Andric/// can occur when performing reference binding to an Objective-C 2650b57cec5SDimitry Andric/// object. 2660b57cec5SDimitry AndricCAST_OPERATION(ObjCObjectLValueCast) 2670b57cec5SDimitry Andric 2680b57cec5SDimitry Andric/// A conversion of a floating point real to a floating point 2690b57cec5SDimitry Andric/// complex of the original type. Injects the value as the real 2700b57cec5SDimitry Andric/// component with a zero imaginary component. 2710b57cec5SDimitry Andric/// float -> _Complex float 2720b57cec5SDimitry AndricCAST_OPERATION(FloatingRealToComplex) 2730b57cec5SDimitry Andric 2740b57cec5SDimitry Andric/// Converts a floating point complex to floating point real 2750b57cec5SDimitry Andric/// of the source's element type. Just discards the imaginary 2760b57cec5SDimitry Andric/// component. 2770b57cec5SDimitry Andric/// _Complex long double -> long double 2780b57cec5SDimitry AndricCAST_OPERATION(FloatingComplexToReal) 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andric/// Converts a floating point complex to bool by comparing 2810b57cec5SDimitry Andric/// against 0+0i. 2820b57cec5SDimitry AndricCAST_OPERATION(FloatingComplexToBoolean) 2830b57cec5SDimitry Andric 2840b57cec5SDimitry Andric/// Converts between different floating point complex types. 2850b57cec5SDimitry Andric/// _Complex float -> _Complex double 2860b57cec5SDimitry AndricCAST_OPERATION(FloatingComplexCast) 2870b57cec5SDimitry Andric 2880b57cec5SDimitry Andric/// Converts from a floating complex to an integral complex. 2890b57cec5SDimitry Andric/// _Complex float -> _Complex int 2900b57cec5SDimitry AndricCAST_OPERATION(FloatingComplexToIntegralComplex) 2910b57cec5SDimitry Andric 2920b57cec5SDimitry Andric/// Converts from an integral real to an integral complex 2930b57cec5SDimitry Andric/// whose element type matches the source. Injects the value as 2940b57cec5SDimitry Andric/// the real component with a zero imaginary component. 2950b57cec5SDimitry Andric/// long -> _Complex long 2960b57cec5SDimitry AndricCAST_OPERATION(IntegralRealToComplex) 2970b57cec5SDimitry Andric 2980b57cec5SDimitry Andric/// Converts an integral complex to an integral real of the 2990b57cec5SDimitry Andric/// source's element type by discarding the imaginary component. 3000b57cec5SDimitry Andric/// _Complex short -> short 3010b57cec5SDimitry AndricCAST_OPERATION(IntegralComplexToReal) 3020b57cec5SDimitry Andric 3030b57cec5SDimitry Andric/// Converts an integral complex to bool by comparing against 3040b57cec5SDimitry Andric/// 0+0i. 3050b57cec5SDimitry AndricCAST_OPERATION(IntegralComplexToBoolean) 3060b57cec5SDimitry Andric 3070b57cec5SDimitry Andric/// Converts between different integral complex types. 3080b57cec5SDimitry Andric/// _Complex char -> _Complex long long 3090b57cec5SDimitry Andric/// _Complex unsigned int -> _Complex signed int 3100b57cec5SDimitry AndricCAST_OPERATION(IntegralComplexCast) 3110b57cec5SDimitry Andric 3120b57cec5SDimitry Andric/// Converts from an integral complex to a floating complex. 3130b57cec5SDimitry Andric/// _Complex unsigned -> _Complex float 3140b57cec5SDimitry AndricCAST_OPERATION(IntegralComplexToFloatingComplex) 3150b57cec5SDimitry Andric 3160b57cec5SDimitry Andric/// [ARC] Produces a retainable object pointer so that it may 3170b57cec5SDimitry Andric/// be consumed, e.g. by being passed to a consuming parameter. 3180b57cec5SDimitry Andric/// Calls objc_retain. 3190b57cec5SDimitry AndricCAST_OPERATION(ARCProduceObject) 3200b57cec5SDimitry Andric 3210b57cec5SDimitry Andric/// [ARC] Consumes a retainable object pointer that has just 3220b57cec5SDimitry Andric/// been produced, e.g. as the return value of a retaining call. 3230b57cec5SDimitry Andric/// Enters a cleanup to call objc_release at some indefinite time. 3240b57cec5SDimitry AndricCAST_OPERATION(ARCConsumeObject) 3250b57cec5SDimitry Andric 3260b57cec5SDimitry Andric/// [ARC] Reclaim a retainable object pointer object that may 3270b57cec5SDimitry Andric/// have been produced and autoreleased as part of a function return 3280b57cec5SDimitry Andric/// sequence. 3290b57cec5SDimitry AndricCAST_OPERATION(ARCReclaimReturnedObject) 3300b57cec5SDimitry Andric 3310b57cec5SDimitry Andric/// [ARC] Causes a value of block type to be copied to the 3320b57cec5SDimitry Andric/// heap, if it is not already there. A number of other operations 3330b57cec5SDimitry Andric/// in ARC cause blocks to be copied; this is for cases where that 3340b57cec5SDimitry Andric/// would not otherwise be guaranteed, such as when casting to a 3350b57cec5SDimitry Andric/// non-block pointer type. 3360b57cec5SDimitry AndricCAST_OPERATION(ARCExtendBlockObject) 3370b57cec5SDimitry Andric 3380b57cec5SDimitry Andric/// Converts from _Atomic(T) to T. 3390b57cec5SDimitry AndricCAST_OPERATION(AtomicToNonAtomic) 3400b57cec5SDimitry Andric/// Converts from T to _Atomic(T). 3410b57cec5SDimitry AndricCAST_OPERATION(NonAtomicToAtomic) 3420b57cec5SDimitry Andric 3430b57cec5SDimitry Andric/// Causes a block literal to by copied to the heap and then 3440b57cec5SDimitry Andric/// autoreleased. 3450b57cec5SDimitry Andric/// 3460b57cec5SDimitry Andric/// This particular cast kind is used for the conversion from a C++11 3470b57cec5SDimitry Andric/// lambda expression to a block pointer. 3480b57cec5SDimitry AndricCAST_OPERATION(CopyAndAutoreleaseBlockObject) 3490b57cec5SDimitry Andric 3500b57cec5SDimitry Andric// Convert a builtin function to a function pointer; only allowed in the 3510b57cec5SDimitry Andric// callee of a call expression. 3520b57cec5SDimitry AndricCAST_OPERATION(BuiltinFnToFnPtr) 3530b57cec5SDimitry Andric 3540b57cec5SDimitry Andric// Convert a zero value for OpenCL opaque types initialization (event_t, 3550b57cec5SDimitry Andric// queue_t, etc.) 3560b57cec5SDimitry AndricCAST_OPERATION(ZeroToOCLOpaqueType) 3570b57cec5SDimitry Andric 3580b57cec5SDimitry Andric// Convert a pointer to a different address space. 3590b57cec5SDimitry AndricCAST_OPERATION(AddressSpaceConversion) 3600b57cec5SDimitry Andric 3610b57cec5SDimitry Andric// Convert an integer initializer to an OpenCL sampler. 3620b57cec5SDimitry AndricCAST_OPERATION(IntToOCLSampler) 3630b57cec5SDimitry Andric 3640b57cec5SDimitry Andric//===- Binary Operations -------------------------------------------------===// 3650b57cec5SDimitry Andric// Operators listed in order of precedence. 36606c3fb27SDimitry Andric// Note that additions to this should also update the StmtVisitor class, 36706c3fb27SDimitry Andric// BinaryOperator::getOverloadedOperator and CXBinaryOperatorKind enum. 3680b57cec5SDimitry Andric 3690b57cec5SDimitry Andric// [C++ 5.5] Pointer-to-member operators. 3700b57cec5SDimitry AndricBINARY_OPERATION(PtrMemD, ".*") 3710b57cec5SDimitry AndricBINARY_OPERATION(PtrMemI, "->*") 3720b57cec5SDimitry Andric// [C99 6.5.5] Multiplicative operators. 3730b57cec5SDimitry AndricBINARY_OPERATION(Mul, "*") 3740b57cec5SDimitry AndricBINARY_OPERATION(Div, "/") 3750b57cec5SDimitry AndricBINARY_OPERATION(Rem, "%") 3760b57cec5SDimitry Andric// [C99 6.5.6] Additive operators. 3770b57cec5SDimitry AndricBINARY_OPERATION(Add, "+") 3780b57cec5SDimitry AndricBINARY_OPERATION(Sub, "-") 3790b57cec5SDimitry Andric// [C99 6.5.7] Bitwise shift operators. 3800b57cec5SDimitry AndricBINARY_OPERATION(Shl, "<<") 3810b57cec5SDimitry AndricBINARY_OPERATION(Shr, ">>") 3820b57cec5SDimitry Andric// C++20 [expr.spaceship] Three-way comparison operator. 3830b57cec5SDimitry AndricBINARY_OPERATION(Cmp, "<=>") 3840b57cec5SDimitry Andric// [C99 6.5.8] Relational operators. 3850b57cec5SDimitry AndricBINARY_OPERATION(LT, "<") 3860b57cec5SDimitry AndricBINARY_OPERATION(GT, ">") 3870b57cec5SDimitry AndricBINARY_OPERATION(LE, "<=") 3880b57cec5SDimitry AndricBINARY_OPERATION(GE, ">=") 3890b57cec5SDimitry Andric// [C99 6.5.9] Equality operators. 3900b57cec5SDimitry AndricBINARY_OPERATION(EQ, "==") 3910b57cec5SDimitry AndricBINARY_OPERATION(NE, "!=") 3920b57cec5SDimitry Andric// [C99 6.5.10] Bitwise AND operator. 3930b57cec5SDimitry AndricBINARY_OPERATION(And, "&") 3940b57cec5SDimitry Andric// [C99 6.5.11] Bitwise XOR operator. 3950b57cec5SDimitry AndricBINARY_OPERATION(Xor, "^") 3960b57cec5SDimitry Andric// [C99 6.5.12] Bitwise OR operator. 3970b57cec5SDimitry AndricBINARY_OPERATION(Or, "|") 3980b57cec5SDimitry Andric// [C99 6.5.13] Logical AND operator. 3990b57cec5SDimitry AndricBINARY_OPERATION(LAnd, "&&") 4000b57cec5SDimitry Andric// [C99 6.5.14] Logical OR operator. 4010b57cec5SDimitry AndricBINARY_OPERATION(LOr, "||") 4020b57cec5SDimitry Andric// [C99 6.5.16] Assignment operators. 4030b57cec5SDimitry AndricBINARY_OPERATION(Assign, "=") 4040b57cec5SDimitry AndricBINARY_OPERATION(MulAssign, "*=") 4050b57cec5SDimitry AndricBINARY_OPERATION(DivAssign, "/=") 4060b57cec5SDimitry AndricBINARY_OPERATION(RemAssign, "%=") 4070b57cec5SDimitry AndricBINARY_OPERATION(AddAssign, "+=") 4080b57cec5SDimitry AndricBINARY_OPERATION(SubAssign, "-=") 4090b57cec5SDimitry AndricBINARY_OPERATION(ShlAssign, "<<=") 4100b57cec5SDimitry AndricBINARY_OPERATION(ShrAssign, ">>=") 4110b57cec5SDimitry AndricBINARY_OPERATION(AndAssign, "&=") 4120b57cec5SDimitry AndricBINARY_OPERATION(XorAssign, "^=") 4130b57cec5SDimitry AndricBINARY_OPERATION(OrAssign, "|=") 4140b57cec5SDimitry Andric// [C99 6.5.17] Comma operator. 4150b57cec5SDimitry AndricBINARY_OPERATION(Comma, ",") 4160b57cec5SDimitry Andric 4170b57cec5SDimitry Andric 4180b57cec5SDimitry Andric//===- Unary Operations ---------------------------------------------------===// 41906c3fb27SDimitry Andric// Note that additions to this should also update the StmtVisitor class, 42006c3fb27SDimitry Andric// UnaryOperator::getOverloadedOperator and CXUnaryOperatorKind enum. 4210b57cec5SDimitry Andric 4220b57cec5SDimitry Andric// [C99 6.5.2.4] Postfix increment and decrement 4230b57cec5SDimitry AndricUNARY_OPERATION(PostInc, "++") 4240b57cec5SDimitry AndricUNARY_OPERATION(PostDec, "--") 4250b57cec5SDimitry Andric// [C99 6.5.3.1] Prefix increment and decrement 4260b57cec5SDimitry AndricUNARY_OPERATION(PreInc, "++") 4270b57cec5SDimitry AndricUNARY_OPERATION(PreDec, "--") 4280b57cec5SDimitry Andric// [C99 6.5.3.2] Address and indirection 4290b57cec5SDimitry AndricUNARY_OPERATION(AddrOf, "&") 4300b57cec5SDimitry AndricUNARY_OPERATION(Deref, "*") 4310b57cec5SDimitry Andric// [C99 6.5.3.3] Unary arithmetic 4320b57cec5SDimitry AndricUNARY_OPERATION(Plus, "+") 4330b57cec5SDimitry AndricUNARY_OPERATION(Minus, "-") 4340b57cec5SDimitry AndricUNARY_OPERATION(Not, "~") 4350b57cec5SDimitry AndricUNARY_OPERATION(LNot, "!") 4360b57cec5SDimitry Andric// "__real expr"/"__imag expr" Extension. 4370b57cec5SDimitry AndricUNARY_OPERATION(Real, "__real") 4380b57cec5SDimitry AndricUNARY_OPERATION(Imag, "__imag") 4390b57cec5SDimitry Andric// __extension__ marker. 4400b57cec5SDimitry AndricUNARY_OPERATION(Extension, "__extension__") 4410b57cec5SDimitry Andric// [C++ Coroutines] co_await operator 4420b57cec5SDimitry AndricUNARY_OPERATION(Coawait, "co_await") 4430b57cec5SDimitry Andric 4440b57cec5SDimitry Andric#undef CAST_OPERATION 4450b57cec5SDimitry Andric#undef BINARY_OPERATION 4460b57cec5SDimitry Andric#undef UNARY_OPERATION 447