LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::StaticLibraryDefinitionGenerator Class Reference

A utility class to expose symbols from a static library. More...

#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"

Inheritance diagram for llvm::orc::StaticLibraryDefinitionGenerator:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::StaticLibraryDefinitionGenerator:
Collaboration graph
[legend]

Public Types

using GetObjectFileInterface = unique_function< Expected< MaterializationUnit::Interface >(ExecutionSession &ES, MemoryBufferRef ObjBuffer)>
 

Public Member Functions

Error tryToGenerate (LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override
 DefinitionGenerators should override this method to insert new definitions into the parent JITDylib. More...
 
- Public Member Functions inherited from llvm::orc::DefinitionGenerator
virtual ~DefinitionGenerator ()
 

Static Public Member Functions

static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load (ObjectLayer &L, const char *FileName, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
 Try to create a StaticLibraryDefinitionGenerator from the given path. More...
 
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load (ObjectLayer &L, const char *FileName, const Triple &TT, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
 Try to create a StaticLibraryDefinitionGenerator from the given path. More...
 
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Create (ObjectLayer &L, std::unique_ptr< MemoryBuffer > ArchiveBuffer, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
 Try to create a StaticLibrarySearchGenerator from the given memory buffer. More...
 

Detailed Description

A utility class to expose symbols from a static library.

If an instance of this class is attached to a JITDylib as a fallback definition generator, then any symbol found in the archive will result in the containing object being added to the JITDylib.

Definition at line 259 of file ExecutionUtils.h.

Member Typedef Documentation

◆ GetObjectFileInterface

Definition at line 264 of file ExecutionUtils.h.

Member Function Documentation

◆ Create()

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Create ( ObjectLayer L,
std::unique_ptr< MemoryBuffer ArchiveBuffer,
GetObjectFileInterface  GetObjFileInterface = GetObjectFileInterface() 
)
static

Try to create a StaticLibrarySearchGenerator from the given memory buffer.

This call will succeed if the buffer contains a valid archive, otherwise it will return an error.

Definition at line 335 of file ExecutionUtils.cpp.

Referenced by Load().

◆ Load() [1/2]

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Load ( ObjectLayer L,
const char *  FileName,
const Triple TT,
GetObjectFileInterface  GetObjFileInterface = GetObjectFileInterface() 
)
static

Try to create a StaticLibraryDefinitionGenerator from the given path.

This call will succeed if the file at the given path is a static library or a MachO universal binary containing a static library that is compatible with the given triple. Otherwise it will return an error.

Definition at line 285 of file ExecutionUtils.cpp.

References B, Create(), llvm::object::createBinary(), llvm::formatv(), llvm::MemoryBuffer::getFileSlice(), llvm::inconvertibleErrorCode(), move, and llvm::Triple::UnknownVendor.

◆ Load() [2/2]

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Load ( ObjectLayer L,
const char *  FileName,
GetObjectFileInterface  GetObjFileInterface = GetObjectFileInterface() 
)
static

Try to create a StaticLibraryDefinitionGenerator from the given path.

This call will succeed if the file at the given path is a static library is a valid archive, otherwise it will return an error.

Definition at line 273 of file ExecutionUtils.cpp.

References Create(), llvm::errorOrToExpected(), llvm::MemoryBuffer::getFile(), and move.

Referenced by LLVMOrcCreateStaticLibrarySearchGeneratorForPath().

◆ tryToGenerate()

Error llvm::orc::StaticLibraryDefinitionGenerator::tryToGenerate ( LookupState LS,
LookupKind  K,
JITDylib JD,
JITDylibLookupFlags  JDLookupFlags,
const SymbolLookupSet LookupSet 
)
overridevirtual

DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.

K specifies the kind of this lookup. JD specifies the target JITDylib being searched, and JDLookupFlags specifies whether the search should match against hidden symbols. Finally, Symbols describes the set of unresolved symbols and their associated lookup flags.

Implements llvm::orc::DefinitionGenerator.

Definition at line 350 of file ExecutionUtils.cpp.

References llvm::orc::ObjectLayer::getExecutionSession(), I, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert(), llvm::None, llvm::orc::Static, and llvm::Error::success().


The documentation for this class was generated from the following files: