[llvm] d08303e - [Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC

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


Author: Jon Roelofs
Date: 2021-12-10T14:21:28-08:00
New Revision: d08303e404167fbb45a6a1b359f7955968403a36

URL: https://github.com/llvm/llvm-project/commit/d08303e404167fbb45a6a1b359f7955968403a36
DIFF: https://github.com/llvm/llvm-project/commit/d08303e404167fbb45a6a1b359f7955968403a36.diff

LOG: [Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC

Differential Revision: https://reviews.llvm.org/D111158

Added: 
    

Modified: 
    llvm/docs/ORCv2.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/ORCv2.rst b/llvm/docs/ORCv2.rst
index c5bc189af8f80..ec372f575b195 100644
--- a/llvm/docs/ORCv2.rst
+++ b/llvm/docs/ORCv2.rst
@@ -730,8 +730,11 @@ For example, to load the whole interface of a runtime library:
     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 @@ Or, to expose an allowed set of symbols from the main process:
 
     // 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.


        


More information about the llvm-commits mailing list