[PATCH] D103774: [lld/mac] Use fewer magic numbers in magic $ld$ handling code

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 6 14:30:43 PDT 2021


alexshap added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:1052
     warn("failed to parse os version, symbol '" + originalName + "' ignored");
-    return;
-  }
-  if (version != config->platformInfo.minimum)
-    return;
-  dylibName = saver.save(installName);
+  else if (version == config->platformInfo.minimum)
+    dylibName = saver.save(installName);
----------------
https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code 
e.g. the "preferred style" also uses extra lines for early returns with the benefit of keeping the code path where the real changes take effect at the same indentation level. Here the code is small enough, personally I don't have a very strong opinion regarding different versions.



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

https://reviews.llvm.org/D103774



More information about the llvm-commits mailing list