[PATCH] D102143: [lld-macho] Treat undefined symbols uniformly

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 10 10:11:55 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/SymbolTable.cpp:190
+void lld::macho::treatUndefinedSymbol(const Undefined &sym, StringRef source) {
+  auto message = [&](const Undefined &sym) {
+    std::string fileName;
----------------
thakis wrote:
> nit: s/&/source/
> 
> And if we're doing capturing, do `[source, sym]` and remove the arg, to make things self-consistent.
> 
> (`&` works here, but with `&` it's easy to accidentally capture a stack variable, and if the closure escapes that's a recipe for subtle bugs, and compilers don't yet warn on default-capturing locals in escaping closures. So I try to not use default capture.)
fair enough. while at it I renamed `message` to `msg` so it doesn't shadow the `message` defined in `lld/Common`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102143



More information about the llvm-commits mailing list