[llvm] [nfc][InstrFDO]Encapsulate header writes in a class member function (PR #90142)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 18:08:03 PDT 2024


================
@@ -612,30 +596,57 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
     OS.write(reinterpret_cast<uint64_t *>(&Header)[I]);
 
   // Save the location of Header.HashOffset field in \c OS.
-  uint64_t HashTableStartFieldOffset = OS.tell();
+  Offsets.HashTableStartFieldOffset = OS.tell();
   // Reserve the space for HashOffset field.
   OS.write(0);
 
   // Save the location of MemProf profile data. This is stored in two parts as
   // the schema and as a separate on-disk chained hashtable.
-  uint64_t MemProfSectionOffset = OS.tell();
+  Offsets.MemProfSectionOffset = OS.tell();
   // Reserve space for the MemProf table field to be patched later if this
   // profile contains memory profile information.
   OS.write(0);
 
   // Save the location of binary ids section.
-  uint64_t BinaryIdSectionOffset = OS.tell();
+  Offsets.BinaryIdSectionOffset = OS.tell();
   // Reserve space for the BinaryIdOffset field to be patched later if this
   // profile contains binary ids.
   OS.write(0);
 
-  uint64_t TemporalProfTracesOffset = OS.tell();
+  Offsets.TemporalProfTracesOffset = OS.tell();
   OS.write(0);
 
-  uint64_t VTableNamesOffset = OS.tell();
+  Offsets.VTableNamesOffset = OS.tell();
   if (!WritePrevVersion)
     OS.write(0);
 
+  return OS.tell() - StartOffset;
----------------
minglotus-6 wrote:

done by using a FIXME at the callsite.

Also chose `(void)` rather than `std::ignore` after searching the differences and came across https://github.com/transmission/transmission/issues/3667#issuecomment-1226027962

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


More information about the llvm-commits mailing list