[PATCH] D143537: [Object][NFC] Factor out computeHeadersSize.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 15:59:59 PST 2023


MaskRay added a comment.

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.



================
Comment at: llvm/lib/Object/ArchiveWriter.cpp:416
+  Size += HeaderSize + SymtabSize;
+  return Size;
+}
----------------
`return strlen("!<arch>\n") + computeSymbolTableHeaderSize() + SymtabSize;`

The compiler will optimize out `strlen`. Avoid trivially-used-once variables.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143537/new/

https://reviews.llvm.org/D143537



More information about the llvm-commits mailing list