1//===--- OperatorKinds.def - C++ Overloaded Operator 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 defines the OverloadedOperator database, which includes 11// all of the overloadable C++ operators. 12// 13//===----------------------------------------------------------------------===// 14// 15/// @file OperatorKinds.def 16/// 17/// In this file, each of the overloadable C++ operators is enumerated 18/// with either the OVERLOADED_OPERATOR or OVERLOADED_OPERATOR_MULTI 19/// macro, each of which can be specified by the code including this 20/// file. OVERLOADED_OPERATOR is used for single-token operators 21/// (e.g., "+"), and has six arguments: 22/// 23/// Name: The name of the token. OO_Name will be the name of the 24/// corresponding enumerator in OverloadedOperatorKind in 25/// OperatorKinds.h. 26/// 27/// Spelling: A string that provides a canonical spelling for the 28/// operator, e.g., "operator+". 29/// 30/// Token: The name of the token that specifies the operator, e.g., 31/// "plus" for operator+ or "greatergreaterequal" for 32/// "operator>>=". With a "kw_" prefix, the token name can be used as 33/// an enumerator into the TokenKind enumeration. 34/// 35/// Unary: True if the operator can be declared as a unary operator. 36/// 37/// Binary: True if the operator can be declared as a binary 38/// operator. Note that some operators (e.g., "operator+" and 39/// "operator*") can be both unary and binary. 40/// 41/// MemberOnly: True if this operator can only be declared as a 42/// non-static member function. False if the operator can be both a 43/// non-member function and a non-static member function. 44/// 45/// OVERLOADED_OPERATOR_MULTI is used to enumerate the multi-token 46/// overloaded operator names, e.g., "operator delete []". The macro 47/// has all of the parameters of OVERLOADED_OPERATOR except Token, 48/// which is omitted. 49 50#ifndef OVERLOADED_OPERATOR 51# define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) 52#endif 53 54#ifndef OVERLOADED_OPERATOR_MULTI 55# define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly) \ 56 OVERLOADED_OPERATOR(Name,Spelling,unknown,Unary,Binary,MemberOnly) 57#endif 58 59OVERLOADED_OPERATOR_MULTI(New , "new" , true , true , false) 60OVERLOADED_OPERATOR_MULTI(Delete , "delete" , true , true , false) 61OVERLOADED_OPERATOR_MULTI(Array_New , "new[]" , true , true , false) 62OVERLOADED_OPERATOR_MULTI(Array_Delete , "delete[]" , true , true , false) 63OVERLOADED_OPERATOR(Plus , "+" , plus , true , true , false) 64OVERLOADED_OPERATOR(Minus , "-" , minus , true , true , false) 65OVERLOADED_OPERATOR(Star , "*" , star , true , true , false) 66OVERLOADED_OPERATOR(Slash , "/" , slash , false, true , false) 67OVERLOADED_OPERATOR(Percent , "%" , percent , false, true , false) 68OVERLOADED_OPERATOR(Caret , "^" , caret , false, true , false) 69OVERLOADED_OPERATOR(Amp , "&" , amp , true , true , false) 70OVERLOADED_OPERATOR(Pipe , "|" , pipe , false, true , false) 71OVERLOADED_OPERATOR(Tilde , "~" , tilde , true , false, false) 72OVERLOADED_OPERATOR(Exclaim , "!" , exclaim , true , false, false) 73OVERLOADED_OPERATOR(Equal , "=" , equal , false, true , true) 74OVERLOADED_OPERATOR(Less , "<" , less , false, true , false) 75OVERLOADED_OPERATOR(Greater , ">" , greater , false, true , false) 76OVERLOADED_OPERATOR(PlusEqual , "+=" , plusequal , false, true , false) 77OVERLOADED_OPERATOR(MinusEqual , "-=" , minusequal , false, true , false) 78OVERLOADED_OPERATOR(StarEqual , "*=" , starequal , false, true , false) 79OVERLOADED_OPERATOR(SlashEqual , "/=" , slashequal , false, true , false) 80OVERLOADED_OPERATOR(PercentEqual , "%=" , percentequal , false, true , false) 81OVERLOADED_OPERATOR(CaretEqual , "^=" , caretequal , false, true , false) 82OVERLOADED_OPERATOR(AmpEqual , "&=" , ampequal , false, true , false) 83OVERLOADED_OPERATOR(PipeEqual , "|=" , pipeequal , false, true , false) 84OVERLOADED_OPERATOR(LessLess , "<<" , lessless , false, true , false) 85OVERLOADED_OPERATOR(GreaterGreater , ">>" , greatergreater , false, true , false) 86OVERLOADED_OPERATOR(LessLessEqual , "<<=" , lesslessequal , false, true , false) 87OVERLOADED_OPERATOR(GreaterGreaterEqual , ">>=" , greatergreaterequal, false, true , false) 88OVERLOADED_OPERATOR(EqualEqual , "==" , equalequal , false, true , false) 89OVERLOADED_OPERATOR(ExclaimEqual , "!=" , exclaimequal , false, true , false) 90OVERLOADED_OPERATOR(LessEqual , "<=" , lessequal , false, true , false) 91OVERLOADED_OPERATOR(GreaterEqual , ">=" , greaterequal , false, true , false) 92OVERLOADED_OPERATOR(AmpAmp , "&&" , ampamp , false, true , false) 93OVERLOADED_OPERATOR(PipePipe , "||" , pipepipe , false, true , false) 94OVERLOADED_OPERATOR(PlusPlus , "++" , plusplus , true , true , false) 95OVERLOADED_OPERATOR(MinusMinus , "--" , minusminus , true , true , false) 96OVERLOADED_OPERATOR(Comma , "," , comma , false, true , false) 97OVERLOADED_OPERATOR(ArrowStar , "->*" , arrowstar , false, true , false) 98OVERLOADED_OPERATOR(Arrow , "->" , arrow , true , false, true) 99OVERLOADED_OPERATOR_MULTI(Call , "()" , true , true , true) 100OVERLOADED_OPERATOR_MULTI(Subscript , "[]" , false, true , true) 101// ?: can *not* be overloaded, but we need the overload 102// resolution machinery for it. 103OVERLOADED_OPERATOR_MULTI(Conditional , "?" , false, true , false) 104OVERLOADED_OPERATOR(Coawait , "co_await", kw_co_await , true , false, false) 105 106#undef OVERLOADED_OPERATOR_MULTI 107#undef OVERLOADED_OPERATOR 108