[llvm] [Archive][COFF] Split hybrid COFF files when adding them to an archive (PR #205160)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 27 15:16:43 PDT 2026
================
@@ -887,12 +916,16 @@ computeMemberData(raw_ostream &StringTable, raw_ostream &SymNames,
uint64_t PrevOffset = 0;
uint64_t NextMemHeadPadSize = 0;
- for (uint32_t Index = 0; Index < Ret.size(); ++Index) {
+ for (uint32_t Index = 0, MemberIndex = 0; Index < Ret.size(); ++Index) {
MemberData &D = Ret[Index];
- const NewArchiveMember *M = &NewMembers[Index];
+ const NewArchiveMember *M = &NewMembers[MemberIndex];
+ if (!D.HybridBuf.get())
+ ++MemberIndex;
raw_string_ostream Out(D.Header);
- MemoryBufferRef Buf = M->Buf->getMemBufferRef();
+ MemoryBufferRef Buf = D.HybridBuf.get() ? D.HybridBuf->getMemBufferRef()
+ : D.SymFile ? D.SymFile->getMemoryBufferRef()
----------------
mstorsjo wrote:
`D.SymFile` is a preexisting field before this change. Can it be nonnull here, so that we end up doing something else, or is it only ever set after this spot?
With better naming of the new field, this might be more understandable, but I think these lines could benefit from a comment explaining what the three different cases are and when they are chosen.
https://github.com/llvm/llvm-project/pull/205160
More information about the llvm-commits
mailing list