================
@@ -126,12 +123,30 @@ void test_oob_lhs(void) {
 }
 #endif
 
-// C++ RHS cases - handler call only
+// C++ cases - handler call only
 
 #ifdef __cplusplus
 
 extern "C" {
 
+// C++ LHS cases
+
+// CXX-LABEL: define {{.*}}@test_cxx_lhs_dot_operator_function_call(
+// CXX: call void @__ubsan_handle_type_mismatch_v1_abort
+void test_cxx_lhs_dot_operator_function_call(AGG *src) {
+  AGG aggValue(void);
+  (*src).operator=(aggValue());
+}
+
+// C++ RHS cases
+
+// CXX-LABEL: define {{.*}}@test_cxx_rhs_operator_function_call(
+// CXX: call void @__ubsan_handle_type_mismatch_v1_abort
----------------
hubert-reinterpretcast wrote:

To expand, for C++, `test_rhs_ptrcheck_deref` verifies that using 
`EmitCheckedLValue` has the intended effect when used at 
https://github.com/llvm/llvm-project/blob/5131f000c9f37ab6b90f9e093b948aee94485921/clang/lib/CodeGen/CGExprCXX.cpp#L270

`test_rhs_ptrcheck_subscript` then does a handler-call-only match by relying on 
the presence of `test_rhs_ptrcheck_deref`.

The test here intends to check the effect of using `EmitCheckedLValue`, with 
basically the same operands, elsewhere in the same function at 
https://github.com/llvm/llvm-project/blob/5131f000c9f37ab6b90f9e093b948aee94485921/clang/lib/CodeGen/CGExprCXX.cpp#L330

Based on the above, I think that _if_ there is only one handler call present, 
then we can say that it is for the intended operand and correct. As the 
resolution to your concern, I propose adding a check against the presence of an 
additional handler call for each case in the test file that performs 
handler-call-only matching.

https://github.com/llvm/llvm-project/pull/203737
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to