================
@@ -80,6 +80,33 @@ void f5(int arg) {
v = f;
}
+void f6(int arg) {
+ int x;
+ if (({ x = 5; }))
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: an assignment within an 'if'
condition is bug-prone [bugprone-assignment-in-if-condition]
+ return;
+}
+
+void f7(int arg) {
+ if (({ int r; r = arg; (r = 1); }))
+ // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: an assignment within an 'if'
condition is bug-prone [bugprone-assignment-in-if-condition]
+ return;
+}
+
+void f8(int arg) {
+ if (({ label: arg = 1; }))
+ // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: an assignment within an 'if'
condition is bug-prone [bugprone-assignment-in-if-condition]
+ return;
+}
+
+int get_value();
+
+void f9(int arg) {
+ if (({ [[clang::nomerge]] arg = get_value(); }))
+ // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: an assignment within an 'if'
condition is bug-prone [bugprone-assignment-in-if-condition]
+ return;
+}
----------------
unterumarmung wrote:
I'd like to understand what was the purpose of it and how
`ValueStmt::getExprStmt` makes it not needed
https://github.com/llvm/llvm-project/pull/231704
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits