LLVM  14.0.0git
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 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)
 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)
 Try to create a StaticLibraryDefinitionGenerator from the given path. More...
 
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Create (ObjectLayer &L, std::unique_ptr< MemoryBuffer > ArchiveBuffer)
 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 260 of file ExecutionUtils.h.

Member Function Documentation

◆ Create()

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Create ( ObjectLayer L,
std::unique_ptr< MemoryBuffer ArchiveBuffer 
)
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 328 of file ExecutionUtils.cpp.

Referenced by Load().

◆ Load() [1/2]

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Load ( ObjectLayer L,
const char *  FileName 
)
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 272 of file ExecutionUtils.cpp.

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

◆ Load() [2/2]

Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > llvm::orc::StaticLibraryDefinitionGenerator::Load ( ObjectLayer L,
const char *  FileName,
const Triple TT 
)
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 282 of file ExecutionUtils.cpp.

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

◆ 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 341 of file ExecutionUtils.cpp.

References 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: