In preparation for COFF archives support.
Details
Diff Detail
Unit Tests
Time | Test | |
---|---|---|
60,040 ms | x64 debian > MLIR.Examples/standalone::test.toy |
Event Timeline
I didn't follow the actual refactoring here yet (it seems at least somewhat nontrivial) - but if this is indeed a pure refactoring, add NFC ("no functional change") as marker to the end of the commit message; in principle, commits are either NFC (with no changes to tests), or if there's a functional change, it should also have a matching test update.
Oh, sorry, I somehow entirely missed that this patch already had the NFC tag. Sorry for the noise...
The computeSymbolTableSize change is reasonable. Other changes increase the number of lines. I do not look at follow-ups so cannot tell whether this is reasonable.
llvm/lib/Object/ArchiveWriter.cpp | ||
---|---|---|
416 | return strlen("!<arch>\n") + computeSymbolTableHeaderSize() + SymtabSize; The compiler will optimize out strlen. Avoid trivially-used-once variables. |
I updated the diff with suggested change. I need separated HeaderSize in later patches to avoid calling computeSymbolTableHeaderSize multiple times, but I moved adding variables later in the series.
Other changes are mostly meant to pass objects' offsets to writeSymbolTable instead of computing it there from scratch. That computation is trivial now, but it becomes more tricky with later patches, as it would need to take second symbol table, string table and EC symbols table into account (both in writeSymbolTable and in new functions writing additional tables).
llvm/lib/Object/ArchiveWriter.cpp | ||
---|---|---|
416 | I may change it here, but then I'd need to introduce them in later patches. HeaderSize is useful, because it avoids calling computeSymbolTableHeaderSize up to 3 times, when we have another headers for the second symbol table and EC symbols. |
llvm/lib/Object/ArchiveWriter.cpp | ||
---|---|---|
700 | 8 meant strlen("!<arch>\n"), I changed it to 0 because computeHeadersSize now takes care of it. I will change bug archive code path to be more similar to other formats, I think it will make it easier to follow. |
Thanks for review. The new version uses llvm::Optional and changes big archive code path to be slightly more similar to other formats.
FYI, most (all?) use of llvm::Optional has been migrated to std::optional these days.
return strlen("!<arch>\n") + computeSymbolTableHeaderSize() + SymtabSize;
The compiler will optimize out strlen. Avoid trivially-used-once variables.