[clang] [Clang][UBSan] Use EmitCheckedLValue for C++ trivial operator= operands (PR #203737)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 20:30:11 PDT 2026


================
@@ -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
----------------
hubert-reinterpretcast wrote:

The operative change in relation to this test is the same as the one that allows `test_lhs_ptrcheck_deref` to pass under C++, namely https://github.com/llvm/llvm-project/blob/5131f000c9f37ab6b90f9e093b948aee94485921/clang/lib/CodeGen/CGExprCXX.cpp#L323

Once the additional test change I propose in https://github.com/llvm/llvm-project/pull/203737/changes#r3439989987 is applied, I believe using the more extensive test pattern here is overkill considering that we are performing grey-box testing with a desire for balance between test complexity (speed of regression testing, maintenance burden) and test coverage.

https://github.com/llvm/llvm-project/pull/203737


More information about the cfe-commits mailing list