[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
Tue Oct 5 08:02:22 PDT 2021


jroelofs created this revision.
jroelofs added a reviewer: lhames.
jroelofs requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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.377253.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/0b78b8f7/attachment.bin>


More information about the llvm-commits mailing list