[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 13:12:44 PDT 2024
================
@@ -5811,9 +5811,12 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
// This function implements trivial copy assignment for HLSL's
// assignable constant arrays.
LValue CodeGenFunction::EmitHLSLArrayAssignLValue(const BinaryOperator *E) {
- LValue TrivialAssignmentRHS = EmitLValue(E->getRHS());
+ // Don't emit an LValue for the RHS because it might not be an LValue
LValue LHS = EmitLValue(E->getLHS());
- EmitAggregateAssign(LHS, TrivialAssignmentRHS, E->getLHS()->getType());
+ // In C assignment operator RHS is often an RValue.
+ // EmitAggregateAssign expects an LValue for the RHS so call the below
+ // function instead.
----------------
llvm-beanz wrote:
minor nit, accept/reject/rework as you see fit.:
```suggestion
// In C the RHS of an assignment operator is an RValue.
// EmitAggregateAssign takesan LValue for the RHS. Instead we can call
// EmitInitializationToLValue to emit an RValue into an LValue.
```
https://github.com/llvm/llvm-project/pull/111047
More information about the cfe-commits
mailing list