@@ -82,6 +82,8 @@ class AsmStateImpl;
8282// ===----------------------------------------------------------------------===//
8383// Resource Entry
8484
85+ class HeapAsmResourceBlob ;
86+
8587// / This class represents a processed binary blob of data. A resource blob is
8688// / essentially a collection of data, potentially mutable, with an associated
8789// / deleter function (used if the data needs to be destroyed).
@@ -177,6 +179,8 @@ class AsmResourceBlob {
177179
178180 // / Whether the data is mutable.
179181 bool dataIsMutable;
182+
183+ friend class HeapAsmResourceBlob ;
180184};
181185
182186// / This class provides a simple utility wrapper for creating heap allocated
@@ -196,8 +200,11 @@ class HeapAsmResourceBlob {
196200 static AsmResourceBlob allocateAndCopyWithAlign (ArrayRef<char > data,
197201 size_t align,
198202 bool dataIsMutable = true ) {
199- AsmResourceBlob blob = allocate (data.size (), align, dataIsMutable);
203+ // This sets the blob to be mutable initially to allow writing
204+ // (getMutableData) below.
205+ AsmResourceBlob blob = allocate (data.size (), align, /* dataIsMutable=*/ true );
200206 std::memcpy (blob.getMutableData ().data (), data.data (), data.size ());
207+ blob.dataIsMutable = dataIsMutable;
201208 return blob;
202209 }
203210 template <typename T>
0 commit comments