[PATCH] D87929: [lld-macho] Support -weak_lx, -weak_library, -weak_framework

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 14:17:10 PDT 2020


int3 added inline comments.


================
Comment at: lld/MachO/Driver.cpp:612
+      auto *dylibFile = dyn_cast_or_null<DylibFile>(addFile(arg->getValue()));
+      if (dylibFile != nullptr)
+        dylibFile->forceWeakImport = true;
----------------
gkm wrote:
> I always find explicit `nullptr`-inequality checks to be overly noisy. I just looked and found that there are only three instances of `!= nullptr` in all of `lld/MachO/*.{h,cpp}`, which IMO is at least two too many. The third is semi-legit for highlighting the boolean nature of pointer-to-something vs. pointer-to-nothing:
> ```
> ./UnwindInfoSection.cpp:  return (compactUnwindSection != nullptr);
> ```
> If you don't feel so strongly about it, then please allow me to impose my will regarding this stylistic nit. If you do feel strongly, then I bet you could find a ton of places to add `!= nullptr`. We could even start an edit war! 😆
¯\_(ツ)_/¯ I mean, I think `!= nullptr` is in line with "explicit over implicit" (yeah I know this isn't Python, but I like to carry the zen of Python wherever I go)... but it's a minor issue in the scheme of things


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87929



More information about the llvm-commits mailing list