================
@@ -568,15 +588,21 @@ void createHostLayoutStructForBuffer(Sema &S, 
HLSLBufferDecl *BufDecl) {
         VD->getType().getAddressSpace() == LangAS::hlsl_groupshared)
       continue;
     const Type *Ty = VD->getType()->getUnqualifiedDesugaredType();
+
+    QualType NewTy;
     if (FieldDecl *FD =
             createFieldForHostLayoutStruct(S, Ty, VD->getIdentifier(), LS)) {
       // add the field decl to the layout struct
       LS->addDecl(FD);
       // update address space of the original decl to hlsl_constant
-      QualType NewTy =
-          AST.getAddrSpaceQualType(VD->getType(), LangAS::hlsl_constant);
-      VD->setType(NewTy);
+      NewTy = AST.getAddrSpaceQualType(VD->getType(), LangAS::hlsl_constant);
+    } else {
+      // Declarations in default cbuffer $Globals had the address space set to
----------------
hekota wrote:

I have updated the change to check for empty declarations in $Globals earlier.

https://github.com/llvm/llvm-project/pull/184276
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to