Skip to content

Commit cc392c7

Browse files
committed
Respond to review feedback.
1 parent 6b0d8ba commit cc392c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/clang/tools/dxcompiler/dxcompilerobj.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1176,18 +1176,18 @@ class DxcCompiler : public IDxcCompiler3,
11761176
"Library targets not supported for Metal (yet).");
11771177
IRObjectGetMetalLibBinary(AIR, Stage, MetalLib);
11781178
size_t MetalLibSize = IRMetalLibGetBytecodeSize(MetalLib);
1179-
uint8_t *MetalLibBytes = new uint8_t[MetalLibSize];
1180-
IRMetalLibGetBytecode(MetalLib, MetalLibBytes);
1179+
std::unique_ptr<uint8_t[]> MetalLibBytes =
1180+
std::unique_ptr<uint8_t[]>(new uint8_t[MetalLibSize]);
1181+
IRMetalLibGetBytecode(MetalLib, MetalLibBytes.get());
11811182

11821183
// Store the metallib to custom format or disk, or use to create a
11831184
// MTLLibrary.
11841185

11851186
CComPtr<IDxcBlob> MetalBlob;
11861187
IFT(hlsl::DxcCreateBlobOnHeapCopy(
1187-
MetalLibBytes, (uint32_t)MetalLibSize, &MetalBlob));
1188+
MetalLibBytes.get(), (uint32_t)MetalLibSize, &MetalBlob));
11881189
std::swap(pOutputBlob, MetalBlob);
11891190

1190-
delete[] MetalLibBytes;
11911191
IRMetalLibBinaryDestroy(MetalLib);
11921192
IRObjectDestroy(DXILObj);
11931193
IRObjectDestroy(AIR);

0 commit comments

Comments
 (0)