[PATCH] D123277: [lld-macho][nfc] De-templatize UnwindInfoSection

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 12:49:06 PDT 2022


int3 added inline comments.


================
Comment at: lld/MachO/UnwindInfoSection.cpp:106-123
+#define SET_OFFSET(Ptr, x) this->x = offsetof(Layout<Ptr>, x)
+  CompactUnwindOffsets(size_t wordSize) {
+    if (wordSize == 8) {
+      SET_OFFSET(uint64_t, functionAddress);
+      SET_OFFSET(uint64_t, functionLength);
+      SET_OFFSET(uint64_t, encoding);
+      SET_OFFSET(uint64_t, personality);
----------------
oontvoo wrote:
> nit: I'm not a big fan of macros and all these lines are quite repetitive,  so i'm wondering if maybe we could shorten them to a helper function like this ^
> (technically shorter :) )
> 
> 
> 
> 
good suggestion, thanks!


================
Comment at: lld/MachO/UnwindInfoSection.cpp:171
+  uint64_t unwindInfoSize = 0;
+  std::vector<decltype(symbols)::value_type> symbolsVec;
+  CompactUnwindOffsets cuOffsets;
----------------
oontvoo wrote:
> Why do you need another symbolsVec? (shouldh't this be inheritted from UnwindInfoSection?)
oh good catch. the `symbolsVec` in the parent class is the redundant one :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123277



More information about the llvm-commits mailing list