diff --git a/llvm/docs/ORCv2.rst b/llvm/docs/ORCv2.rst --- a/llvm/docs/ORCv2.rst +++ b/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.