================
@@ -5570,11 +5570,44 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const 
BinaryOperator *E) {
       break;
     }
 
-    RValue RV = EmitAnyExpr(E->getRHS());
+    llvm::Value *Previous = nullptr;
+    RValue RV;
+    QualType SrcType = E->getRHS()->getType();
+    // If LHS refers to a bitfield we want to retrieve the value before
+    // implicit conversion between the bitfield type and the RHS type
+    // and evaluate RHS without integer sanitizer checks (if passed)
+    if (auto *ICE = RetrieveImplicitCastExprForBitfieldSanitizer(E)) {
----------------
rjmccall wrote:

When we say "conversion between A and B", it typically means A is being 
converted to B, but I think you're actually talking about the reverse here.

Please pull the basic conditions for whether to emit this check into this 
function (LHS is a bit-field + the sanitizer option); it will make the data 
flow much clearer.  You can just evaluate them once and then check it again 
below.

Please test for a bit-field LHS before checking for the sanitizer option.

The function call here should be something like 
`getOriginalRHSForBitfieldSanitizer`.

https://github.com/llvm/llvm-project/pull/75481
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to