[PATCH] D111158: [Docs][ORCv2] GetForCurrentProcess now returns an ErrorOr<std::unique_ptr>. NFC

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 14:21:45 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd08303e40416: [Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC (authored by jroelofs).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111158

Files:
  llvm/docs/ORCv2.rst


Index: llvm/docs/ORCv2.rst
===================================================================
--- llvm/docs/ORCv2.rst
+++ llvm/docs/ORCv2.rst
@@ -730,8 +730,11 @@
     const DataLayout &DL = getDataLayout();
     auto &JD = ES.createJITDylib("main");
 
-    JD.addGenerator(DynamicLibrarySearchGenerator::Load("/path/to/lib"
-                                                        DL.getGlobalPrefix()));
+    if (auto DLSGOrErr = DynamicLibrarySearchGenerator::Load("/path/to/lib"
+                                                             DL.getGlobalPrefix()))
+      JD.addGenerator(std::move(*DLSGOrErr);
+    else
+      return DLSGOrErr.takeError();
 
     // IR added to JD can now link against all symbols exported by the library
     // at '/path/to/lib'.
@@ -753,10 +756,9 @@
 
     // Use GetForCurrentProcess with a predicate function that checks the
     // allowed list.
-    JD.addGenerator(
-      DynamicLibrarySearchGenerator::GetForCurrentProcess(
-        DL.getGlobalPrefix(),
-        [&](const SymbolStringPtr &S) { return AllowList.count(S); }));
+    JD.addGenerator(cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
+          DL.getGlobalPrefix(),
+          [&](const SymbolStringPtr &S) { return AllowList.count(S); })));
 
     // IR added to JD can now link against any symbols exported by the process
     // and contained in the list.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111158.393595.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211210/58acc5e8/attachment.bin>


More information about the llvm-commits mailing list