[llvm] [SystemZ][z/OS] TXT records in the GOFF reader (PR #74526)
Yusra Syeda via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 14:23:26 PDT 2024
================
@@ -507,21 +500,22 @@ GOFFObjectFile::getSectionContents(DataRefImpl Sec) const {
SmallString<256> CompleteData;
CompleteData.reserve(TxtDataSize);
- if (auto Err = TXTRecord::getData(TxtRecordPtr, CompleteData))
+ if (Error Err = TXTRecord::getData(TxtRecordPtr, CompleteData))
return std::move(Err);
assert(CompleteData.size() == TxtDataSize && "Wrong length of data");
- memcpy(Data + TxtDataOffset, CompleteData.data(), TxtDataSize);
+ std::copy(CompleteData.data(), CompleteData.data() + TxtDataSize,
+ Data.begin() + TxtDataOffset);
}
-
+ auto DataPtr = Data;
----------------
ysyeda wrote:
I removed the need for `DataPtr`. Previously I needed to use std::move to move the Data contents since the SmallVector in `SectionDataCache` had a template parameter of 0 for the size, but `Data` did not. This caused the operator= to not work. I removed `DataPtr` by using the same template parameters for SmallVector in `SectionDataCache` and `Data`. This should also answer your question above.
https://github.com/llvm/llvm-project/pull/74526
More information about the llvm-commits
mailing list