================
@@ -15522,6 +15533,18 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation
OpLoc,
switch (Opc) {
case BO_Assign:
+ // If this is HLSL and the LHS is a record try to perform aggregate
+ // initialization.
+ if (getLangOpts().HLSL && LHSExpr->getType()->isRecordType()) {
+ ResultTy = LHSExpr->getType();
+ ExprResult Init =
+ HLSL().tryAggregateInitialization(*this, ResultTy, RHSExpr);
+ if (Init.isInvalid())
+ return Init;
+ RHS = Init.get();
+ break;
+ }
+
----------------
s-perron wrote:
Cool. While you get this cleaned up, please take the constantbuffer cases into
consideration: https://godbolt.org/z/z39rTq1Pq.
Assignments and initialization of structs from a ConstantBuffer<S> will require
HLSL specific handling. I'll probably want to make this another case in
whatever code you add.
https://github.com/llvm/llvm-project/pull/190089
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits