Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 | |||
58 | OVERLOADED_OPERATOR_MULTI(New , "new" , true , true , false) |
||
59 | OVERLOADED_OPERATOR_MULTI(Delete , "delete" , true , true , false) |
||
60 | OVERLOADED_OPERATOR_MULTI(Array_New , "new[]" , true , true , false) |
||
61 | OVERLOADED_OPERATOR_MULTI(Array_Delete , "delete[]" , true , true , false) |
||
62 | OVERLOADED_OPERATOR(Plus , "+" , plus , true , true , false) |
||
63 | OVERLOADED_OPERATOR(Minus , "-" , minus , true , true , false) |
||
64 | OVERLOADED_OPERATOR(Star , "*" , star , true , true , false) |
||
65 | OVERLOADED_OPERATOR(Slash , "/" , slash , false, true , false) |
||
66 | OVERLOADED_OPERATOR(Percent , "%" , percent , false, true , false) |
||
67 | OVERLOADED_OPERATOR(Caret , "^" , caret , false, true , false) |
||
68 | OVERLOADED_OPERATOR(Amp , "&" , amp , true , true , false) |
||
69 | OVERLOADED_OPERATOR(Pipe , "|" , pipe , false, true , false) |
||
70 | OVERLOADED_OPERATOR(Tilde , "~" , tilde , true , false, false) |
||
71 | OVERLOADED_OPERATOR(Exclaim , "!" , exclaim , true , false, false) |
||
72 | OVERLOADED_OPERATOR(Equal , "=" , equal , false, true , true) |
||
73 | OVERLOADED_OPERATOR(Less , "<" , less , false, true , false) |
||
74 | OVERLOADED_OPERATOR(Greater , ">" , greater , false, true , false) |
||
75 | OVERLOADED_OPERATOR(PlusEqual , "+=" , plusequal , false, true , false) |
||
76 | OVERLOADED_OPERATOR(MinusEqual , "-=" , minusequal , false, true , false) |
||
77 | OVERLOADED_OPERATOR(StarEqual , "*=" , starequal , false, true , false) |
||
78 | OVERLOADED_OPERATOR(SlashEqual , "/=" , slashequal , false, true , false) |
||
79 | OVERLOADED_OPERATOR(PercentEqual , "%=" , percentequal , false, true , false) |
||
80 | OVERLOADED_OPERATOR(CaretEqual , "^=" , caretequal , false, true , false) |
||
81 | OVERLOADED_OPERATOR(AmpEqual , "&=" , ampequal , false, true , false) |
||
82 | OVERLOADED_OPERATOR(PipeEqual , "|=" , pipeequal , false, true , false) |
||
83 | OVERLOADED_OPERATOR(LessLess , "<<" , lessless , false, true , false) |
||
84 | OVERLOADED_OPERATOR(GreaterGreater , ">>" , greatergreater , false, true , false) |
||
85 | OVERLOADED_OPERATOR(LessLessEqual , "<<=" , lesslessequal , false, true , false) |
||
86 | OVERLOADED_OPERATOR(GreaterGreaterEqual , ">>=" , greatergreaterequal, false, true , false) |
||
87 | OVERLOADED_OPERATOR(EqualEqual , "==" , equalequal , false, true , false) |
||
88 | OVERLOADED_OPERATOR(ExclaimEqual , "!=" , exclaimequal , false, true , false) |
||
89 | OVERLOADED_OPERATOR(LessEqual , "<=" , lessequal , false, true , false) |
||
90 | OVERLOADED_OPERATOR(GreaterEqual , ">=" , greaterequal , false, true , false) |
||
91 | OVERLOADED_OPERATOR(Spaceship , "<=>" , spaceship , false, true , false) |
||
92 | OVERLOADED_OPERATOR(AmpAmp , "&&" , ampamp , false, true , false) |
||
93 | OVERLOADED_OPERATOR(PipePipe , "||" , pipepipe , false, true , false) |
||
94 | OVERLOADED_OPERATOR(PlusPlus , "++" , plusplus , true , true , false) |
||
95 | OVERLOADED_OPERATOR(MinusMinus , "--" , minusminus , true , true , false) |
||
96 | OVERLOADED_OPERATOR(Comma , "," , comma , false, true , false) |
||
97 | OVERLOADED_OPERATOR(ArrowStar , "->*" , arrowstar , false, true , false) |
||
98 | OVERLOADED_OPERATOR(Arrow , "->" , arrow , true , false, true) |
||
99 | OVERLOADED_OPERATOR_MULTI(Call , "()" , true , true , true) |
||
100 | OVERLOADED_OPERATOR_MULTI(Subscript , "[]" , false, true , true) |
||
101 | // ?: can *not* be overloaded, but we need the overload |
||
102 | // resolution machinery for it. |
||
103 | OVERLOADED_OPERATOR_MULTI(Conditional , "?" , false, true , false) |
||
104 | OVERLOADED_OPERATOR(Coawait , "co_await", kw_co_await , true , false, false) |
||
105 | |||
106 | #undef OVERLOADED_OPERATOR_MULTI |
||
107 | #undef OVERLOADED_OPERATOR |