Martin =?utf-8?q?Bednár?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -90,3 +91,148 @@ void func(void) {
// CHECK: CompoundAssignOperator=^= BinOp=^= 31
// CHECK: CompoundAssignOperator=|= BinOp=|= 32
// CHECK: BinaryOperator=, BinOp=, 33
+
+struct D {
+ D() = default;
+ D& operator+(){return *this;}
+ D& operator-(){return *this;}
+ D& operator*(const D&){return *this;}
+ D& operator/(const D&){return *this;}
+ D& operator%(const D&){return *this;}
+ D& operator+(const D&){return *this;}
+ D& operator-(const D&){return *this;}
+
+ D& operator<<(const D&){return *this;}
+ D& operator>>(const D&){return *this;}
+
+ bool operator<(const D&){return true;}
+ bool operator>(const D&){return true;}
+ bool operator<=(const D&){return true;}
+ bool operator>=(const D&){return true;}
+ bool operator==(const D&){return true;}
+ bool operator!=(const D&){return true;}
+
+ D& operator|(const D&){return *this;}
+ D& operator&(const D&){return *this;}
+ D& operator^(const D&){return *this;}
+
+ bool operator&&(const D&){return true;}
+ bool operator||(const D&){return true;}
+
+ D& operator+=(const D&){return *this;}
+ D& operator-=(const D&){return *this;}
+ D& operator*=(const D&){return *this;}
+ D& operator/=(const D&){return *this;}
+ D& operator%=(const D&){return *this;}
+ D& operator&=(const D&){return *this;}
+ D& operator|=(const D&){return *this;}
+ D& operator^=(const D&){return *this;}
+ D& operator<<=(const D&){return *this;}
+ D& operator>>=(const D&){return *this;}
+ D& operator,(const D&){return *this;}
+
+ int& operator->*(int D::*i){return this->i;}
+
+ // Negative test of --/++
+ D& operator++(){return *this;};
+ D& operator++(int){return *this;};
+ D& operator--(){return *this;};
+ D& operator--(int){return *this;};
+
+ int i;
+};
+
+void func2(void) {
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wunused-value"
+ D a, b;
+ int D::*p = &D::i;
+
+ D *pc;
+ a->*p;
+
+ a *b;
+ a / b;
+ a % b;
+ a + b;
+ a - b;
+
+ a << b;
+ a >> b;
+
+ a < b;
+ a > b;
+
+ a <= b;
+ a >= b;
+ a == b;
+ a != b;
+
+ a &b;
+ a ^ b;
+ a | b;
+
+ a &&b;
+ a || b;
+
+ a = b;
+
+ a *= b;
+ a /= b;
+ a %= b;
+ a += b;
+ a -= b;
+
+ a <<= b;
+ a >>= b;
+
+ a &= b;
+ a ^= b;
+ a |= b;
+ a, b;
+
+// Negative test
+ a++;
+ ++a;
+ a--;
+ --a;
+ #pragma clang diagnostic pop
+}
+
+// CHECK: CallExpr=D:96:3 BinOp= 0
+// CHECK: CallExpr=D:96:3 BinOp= 0
+// CHECK: CallExpr=operator->*:134:8 BinOp=->* 2
+// CHECK: CallExpr=operator*:99:6 BinOp=* 3
+// CHECK: CallExpr=operator/:100:6 BinOp=/ 4
+// CHECK: CallExpr=operator%:101:6 BinOp=% 5
+// CHECK: CallExpr=operator+:102:6 BinOp=+ 6
+// CHECK: CallExpr=operator-:103:6 BinOp=- 7
+// CHECK: CallExpr=operator<<:105:6 BinOp=<< 8
+// CHECK: CallExpr=operator>>:106:6 BinOp=>> 9
+// CHECK: CallExpr=operator<:108:8 BinOp=< 11
+// CHECK: CallExpr=operator>:109:8 BinOp=> 12
+// CHECK: CallExpr=operator<=:110:8 BinOp=<= 13
+// CHECK: CallExpr=operator>=:111:8 BinOp=>= 14
+// CHECK: CallExpr=operator==:112:8 BinOp=== 15
+// CHECK: CallExpr=operator!=:113:8 BinOp=!= 16
+// CHECK: CallExpr=operator&:116:6 BinOp=& 17
+// CHECK: CallExpr=operator^:117:6 BinOp=^ 18
+// CHECK: CallExpr=operator|:115:6 BinOp=| 19
+// CHECK: CallExpr=operator&&:119:8 BinOp=&& 20
+// CHECK: CallExpr=operator||:120:8 BinOp=|| 21
+// CHECK: CallExpr=operator=:95:8 BinOp== 22
+// CHECK: CallExpr=operator*=:124:6 BinOp=*= 23
+// CHECK: CallExpr=operator/=:125:6 BinOp=/= 24
+// CHECK: CallExpr=operator%=:126:6 BinOp=%= 25
+// CHECK: CallExpr=operator+=:122:6 BinOp=+= 26
+// CHECK: CallExpr=operator-=:123:6 BinOp=-= 27
+// CHECK: CallExpr=operator<<=:130:6 BinOp=<<= 28
+// CHECK: CallExpr=operator>>=:131:6 BinOp=>>= 29
+// CHECK: CallExpr=operator&=:127:6 BinOp=&= 30
+// CHECK: CallExpr=operator^=:129:6 BinOp=^= 31
+// CHECK: CallExpr=operator|=:128:6 BinOp=|= 32
+// CHECK: CallExpr=operator,:132:6 BinOp=, 33
+// CHECK: CallExpr=operator++:138:6 BinOp= 0
+// CHECK: CallExpr=operator++:137:6 BinOp= 0
+// CHECK: CallExpr=operator--:140:6 BinOp= 0
+// CHECK: CallExpr=operator--:139:6 BinOp= 0
----------------
Serafean wrote:
To check the condition
https://github.com/llvm/llvm-project/pull/182303/changes#diff-3765aaebbb512d97fa5552ffecf3d8fdced0a24a80a35a2d9aaa0bd4abdbbe47R10207
works.
https://github.com/llvm/llvm-project/pull/182303
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits