================
@@ -860,26 +929,35 @@ std::optional<LValue> 
CGHLSLRuntime::emitResourceArraySubscriptExpr(
       TmpVar, Qualifiers(), AggValueSlot::IsDestructed_t(true),
       AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsAliased_t(false),
       AggValueSlot::DoesNotOverlap);
-
-  Address ThisAddress = ValueSlot.getAddress();
-  llvm::Value *ThisPtr = CGF.getAsNaturalPointerTo(
-      ThisAddress, CD->getThisType()->getPointeeType());
+  Address TmpVarAddress = ValueSlot.getAddress();
 
   // get total array size (= range size)
   llvm::Value *Range =
       llvm::ConstantInt::get(CGM.IntTy, getTotalArraySize(AST, ResArrayTy));
 
-  // assemble the constructor parameters
-  CallArgList Args;
-  createResourceCtorArgs(CGM, CD, ThisPtr, Range, Index, ArrayDecl->getName(),
-                         RBA, VkBinding, Args);
-
-  // call the constructor
-  CGF.EmitCXXConstructorCall(CD, Ctor_Complete, false, false, ThisAddress, 
Args,
-                             ValueSlot.mayOverlap(),
-                             ArraySubsExpr->getExprLoc(),
-                             ValueSlot.isSanitizerChecked());
-
-  return CGF.MakeAddrLValue(TmpVar, ArraySubsExpr->getType(),
-                            AlignmentSource::Decl);
+  // if the result of the subscript operation is a single resource - call the
+  // constructor
+  if (ResultTy == ResourceTy) {
+    QualType ThisType = CD->getThisType()->getPointeeType();
+    llvm::Value *ThisPtr = CGF.getAsNaturalPointerTo(TmpVarAddress, ThisType);
+
+    // assemble the constructor parameters
----------------
llvm-beanz wrote:

```suggestion
    // Assemble the constructor parameters.
```

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

Reply via email to