[Lldb-commits] [PATCH] D142309: [LLDB][NFC] Fix a incorrect use of shared_ptr in RenderScriptRuntime.cpp
Shivam Gupta via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 23 21:56:03 PST 2023
xgupta updated this revision to Diff 491601.
xgupta added a comment.
fix build
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142309/new/
https://reviews.llvm.org/D142309
Files:
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===================================================================
--- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -528,7 +528,7 @@
AllocationDetails *FindAllocByID(Stream &strm, const uint32_t alloc_id);
- std::shared_ptr<uint8_t> GetAllocationData(AllocationDetails *alloc,
+ std::shared_ptr<uint8_t []> GetAllocationData(AllocationDetails *alloc,
StackFrame *frame_ptr);
void SetElementSize(Element &elem);
@@ -538,7 +538,7 @@
void FindStructTypeName(Element &elem, StackFrame *frame_ptr);
- size_t PopulateElementHeaders(const std::shared_ptr<uint8_t> header_buffer,
+ size_t PopulateElementHeaders(const std::shared_ptr<uint8_t []> header_buffer,
size_t offset, const Element &elem);
size_t CalculateElementHeaderSize(const Element &elem);
Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -2346,7 +2346,7 @@
// Given an allocation, this function copies the allocation contents from
// device into a buffer on the heap. Returning a shared pointer to the buffer
// containing the data.
-std::shared_ptr<uint8_t>
+std::shared_ptr<uint8_t []>
RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,
StackFrame *frame_ptr) {
Log *log = GetLog(LLDBLog::Language);
@@ -2368,7 +2368,7 @@
// Allocate a buffer to copy data into
const uint32_t size = *alloc->size.get();
- std::shared_ptr<uint8_t> buffer(new uint8_t[size]);
+ std::shared_ptr<uint8_t []> buffer(new uint8_t[size]);
if (!buffer) {
LLDB_LOGF(log, "%s - couldn't allocate a %" PRIu32 " byte buffer",
__FUNCTION__, size);
@@ -2557,7 +2557,7 @@
// saved to the file as the ElementHeader struct followed by offsets to the
// structs of all the element's children.
size_t RenderScriptRuntime::PopulateElementHeaders(
- const std::shared_ptr<uint8_t> header_buffer, size_t offset,
+ const std::shared_ptr<uint8_t []> header_buffer, size_t offset,
const Element &elem) {
// File struct for an element header with all the relevant details copied
// from elem. We assume members are valid already.
@@ -2661,7 +2661,7 @@
}
// Read allocation into buffer of heap memory
- const std::shared_ptr<uint8_t> buffer = GetAllocationData(alloc, frame_ptr);
+ const std::shared_ptr<uint8_t []> buffer = GetAllocationData(alloc, frame_ptr);
if (!buffer) {
strm.Printf("Error: Couldn't read allocation data into buffer");
strm.EOL();
@@ -2695,7 +2695,7 @@
}
// Create the headers describing the element type of the allocation.
- std::shared_ptr<uint8_t> element_header_buffer(
+ std::shared_ptr<uint8_t []> element_header_buffer(
new uint8_t[element_header_size]);
if (element_header_buffer == nullptr) {
strm.Printf("Internal Error: Couldn't allocate %" PRIu64
@@ -3214,7 +3214,7 @@
__FUNCTION__, data_size);
// Allocate a buffer to copy data into
- std::shared_ptr<uint8_t> buffer = GetAllocationData(alloc, frame_ptr);
+ std::shared_ptr<uint8_t []> buffer = GetAllocationData(alloc, frame_ptr);
if (!buffer) {
strm.Printf("Error: Couldn't read allocation data");
strm.EOL();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142309.491601.patch
Type: text/x-patch
Size: 3773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230124/97a52cf6/attachment-0001.bin>
More information about the lldb-commits
mailing list