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

source code of clang/include/clang/Basic/OperatorKinds.def