[llvm] [SystemZ][z/OS] TXT records in the GOFF reader (PR #74526)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 01:30:17 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;
----------------
jh7370 wrote:

`auto` is actively impairing readability here. Don't use it. Please refer to the LLVM style guide on when it is appropriate to use `auto`.

I'm not really following what you're trying to achieve here, probably made worse by the fact that the name `DataPtr` implies a pointer, whereas `Data` appears to be a vector, so not a pointer.

https://github.com/llvm/llvm-project/pull/74526


More information about the llvm-commits mailing list