@@ -5843,24 +5843,31 @@ bool HLSLBufferDecl::buffer_decls_empty() {
58435843// HLSLRootSignatureDecl Implementation
58445844// ===----------------------------------------------------------------------===//
58455845
5846- HLSLRootSignatureDecl::HLSLRootSignatureDecl (
5847- DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
5848- ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements)
5846+ HLSLRootSignatureDecl::HLSLRootSignatureDecl (DeclContext *DC,
5847+ SourceLocation Loc,
5848+ IdentifierInfo *ID,
5849+ unsigned NumElems)
58495850 : NamedDecl(Decl::Kind::HLSLRootSignature, DC, Loc, DeclarationName(ID)),
5850- RootElements(RootElements ) {}
5851+ NumElems(NumElems ) {}
58515852
58525853HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create (
58535854 ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID,
58545855 ArrayRef<llvm::hlsl::rootsig::RootElement> RootElements) {
5855- HLSLRootSignatureDecl *Result =
5856- new (C, DC) HLSLRootSignatureDecl (DC, Loc, ID, RootElements);
5857- return Result;
5856+ HLSLRootSignatureDecl *RSDecl =
5857+ new (C, DC,
5858+ additionalSizeToAlloc<llvm::hlsl::rootsig::RootElement>(
5859+ RootElements.size ()))
5860+ HLSLRootSignatureDecl (DC, Loc, ID, RootElements.size ());
5861+ auto *StoredElems = RSDecl->getElems ();
5862+ std::uninitialized_copy (RootElements.begin (), RootElements.end (),
5863+ StoredElems);
5864+ return RSDecl;
58585865}
58595866
58605867HLSLRootSignatureDecl *
58615868HLSLRootSignatureDecl::CreateDeserialized (ASTContext &C, GlobalDeclID ID) {
5862- HLSLRootSignatureDecl *Result =
5863- new (C, ID) HLSLRootSignatureDecl (nullptr , SourceLocation (), nullptr , {} );
5869+ HLSLRootSignatureDecl *Result = new (C, ID)
5870+ HLSLRootSignatureDecl (nullptr , SourceLocation (), nullptr , /* NumElems= */ 0 );
58645871 return Result;
58655872}
58665873
0 commit comments