[PATCH] D119049: [LLD] Allow usage of LLD as a library

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 15:31:05 PST 2023


MaskRay added inline comments.


================
Comment at: lld/Common/CMakeLists.txt:29
   Filesystem.cpp
+  DriversMain.cpp
   Memory.cpp
----------------
Keep the file list sorted


================
Comment at: lld/Common/DriversMain.cpp:1
+//===- LLDLibrary.cpp - Use LLD as a library ------------------------------===//
+//
----------------
DriverMain instead of DriversMain? I wonder whether `Dispatcher` in the filename can make it clearer. We have many functions/files with `main` or `Main` in the names now...

Also, the header needs a fix.


================
Comment at: lld/tools/lld/lld.cpp:85
+  if (!inTestVerbosity()) {
+    lld::Result r = lldMain(args, llvm::outs(), llvm::errs(), LLD_ALL_DRIVERS,
+                            /*libUsage=*/false);
----------------
This can call `unsafeLldMain` instead, then the parameter `bool libUsage` can be removed. The downside is that `unsafeLldMain` will be in an include header but that's probably fine (unsure whether moving it into a nested namespace to discourage its use is useful).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119049



More information about the llvm-commits mailing list