[PATCH] D59800: Use a class instead of lambda-based callbacks to organize garbage collector.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 15:02:06 PDT 2019


ruiu created this revision.
ruiu added reviewers: pcc, rocallahan.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

lld's mark-sweep garbage collector was written in the visitor pattern.
There are functions that traverses a given graph, and the functions calls
callback functions to dispatch according to node type.

The code was originaly pretty simple, and lambdas worked pretty
well. However, as we add more features to the garbage collector, that became
more like a callback hell. We now have a callback function that wraps
another callback function, for example. It is not easy to follow the flow of
the control.

This patch rewrites it as a regular class. What was once a lambda is now a
regular class member function. I think this change fixes the readability
issue.

No functionality change intended.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59800

Files:
  lld/ELF/MarkLive.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59800.192211.patch
Type: text/x-patch
Size: 12147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190325/d9152144/attachment.bin>


More information about the llvm-commits mailing list