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

A set of symbols to look up, each associated with a SymbolLookupFlags value. More...

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

Public Types

using value_type = std::pair< SymbolStringPtr, SymbolLookupFlags >
 
using UnderlyingVector = std::vector< value_type >
 
using iterator = UnderlyingVector::iterator
 
using const_iterator = UnderlyingVector::const_iterator
 

Public Member Functions

 SymbolLookupSet ()=default
 
 SymbolLookupSet (SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 
 SymbolLookupSet (std::initializer_list< SymbolStringPtr > Names, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 Construct a SymbolLookupSet from an initializer list of SymbolStringPtrs. More...
 
 SymbolLookupSet (const SymbolNameSet &Names, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 Construct a SymbolLookupSet from a SymbolNameSet with the given Flags used for each value. More...
 
 SymbolLookupSet (ArrayRef< SymbolStringPtr > Names, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 Construct a SymbolLookupSet from a vector of symbols with the given Flags used for each value. More...
 
SymbolLookupSetadd (SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 Add an element to the set. More...
 
SymbolLookupSetappend (SymbolLookupSet Other)
 Quickly append one lookup set to another. More...
 
bool empty () const
 
UnderlyingVector::size_type size () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void remove (UnderlyingVector::size_type I)
 Removes the Ith element of the vector, replacing it with the last element. More...
 
void remove (iterator I)
 Removes the element pointed to by the given iterator. More...
 
template<typename PredFn >
void remove_if (PredFn &&Pred)
 Removes all elements matching the given predicate, which must be callable as bool(const SymbolStringPtr &, SymbolLookupFlags Flags). More...
 
template<typename BodyFn >
auto forEachWithRemoval (BodyFn &&Body) -> std::enable_if_t< std::is_same< decltype(Body(std::declval< const SymbolStringPtr & >(), std::declval< SymbolLookupFlags >())), bool >::value >
 Loop over the elements of this SymbolLookupSet, applying the Body function to each one. More...
 
template<typename BodyFn >
auto forEachWithRemoval (BodyFn &&Body) -> std::enable_if_t< std::is_same< decltype(Body(std::declval< const SymbolStringPtr & >(), std::declval< SymbolLookupFlags >())), Expected< bool >>::value, Error >
 Loop over the elements of this SymbolLookupSet, applying the Body function to each one. More...
 
SymbolNameVector getSymbolNames () const
 Construct a SymbolNameVector from this instance by dropping the Flags values. More...
 
void sortByAddress ()
 Sort the lookup set by pointer value. More...
 
void sortByName ()
 Sort the lookup set lexicographically. More...
 
void removeDuplicates ()
 Remove any duplicate elements. More...
 
bool containsDuplicates ()
 Returns true if this set contains any duplicates. More...
 

Static Public Member Functions

template<typename KeyT >
static SymbolLookupSet fromMapKeys (const DenseMap< SymbolStringPtr, KeyT > &M, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
 Construct a SymbolLookupSet from DenseMap keys. More...
 

Detailed Description

A set of symbols to look up, each associated with a SymbolLookupFlags value.

This class is backed by a vector and optimized for fast insertion, deletion and iteration. It does not guarantee a stable order between operations, and will not automatically detect duplicate elements (they can be manually checked by calling the validate method).

Definition at line 175 of file Core.h.

Member Typedef Documentation

◆ const_iterator

using llvm::orc::SymbolLookupSet::const_iterator = UnderlyingVector::const_iterator

Definition at line 180 of file Core.h.

◆ iterator

using llvm::orc::SymbolLookupSet::iterator = UnderlyingVector::iterator

Definition at line 179 of file Core.h.

◆ UnderlyingVector

Definition at line 178 of file Core.h.

◆ value_type

Definition at line 177 of file Core.h.

Constructor & Destructor Documentation

◆ SymbolLookupSet() [1/5]

llvm::orc::SymbolLookupSet::SymbolLookupSet ( )
default

◆ SymbolLookupSet() [2/5]

llvm::orc::SymbolLookupSet::SymbolLookupSet ( SymbolStringPtr  Name,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inlineexplicit

Definition at line 184 of file Core.h.

References add(), and move.

◆ SymbolLookupSet() [3/5]

llvm::orc::SymbolLookupSet::SymbolLookupSet ( std::initializer_list< SymbolStringPtr Names,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inlineexplicit

Construct a SymbolLookupSet from an initializer list of SymbolStringPtrs.

Definition at line 191 of file Core.h.

References add(), and move.

◆ SymbolLookupSet() [4/5]

llvm::orc::SymbolLookupSet::SymbolLookupSet ( const SymbolNameSet Names,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inlineexplicit

Construct a SymbolLookupSet from a SymbolNameSet with the given Flags used for each value.

Definition at line 201 of file Core.h.

References add(), and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::size().

◆ SymbolLookupSet() [5/5]

llvm::orc::SymbolLookupSet::SymbolLookupSet ( ArrayRef< SymbolStringPtr Names,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inlineexplicit

Construct a SymbolLookupSet from a vector of symbols with the given Flags used for each value.

If the ArrayRef contains duplicates it is up to the client to remove these before using this instance for lookup.

Definition at line 213 of file Core.h.

References add(), and llvm::ArrayRef< T >::size().

Member Function Documentation

◆ add()

SymbolLookupSet& llvm::orc::SymbolLookupSet::add ( SymbolStringPtr  Name,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inline

Add an element to the set.

The client is responsible for checking that duplicates are not added.

Definition at line 236 of file Core.h.

References move.

Referenced by llvm::orc::EPCEHFrameRegistrar::Create(), llvm::orc::createJITLoaderGDBRegistrar(), llvm::orc::ObjectLinkingLayerJITLinkContext::lookup(), llvm::orc::CtorDtorRunner::run(), SymbolLookupSet(), and llvm::orc::EPCDynamicLibrarySearchGenerator::tryToGenerate().

◆ append()

SymbolLookupSet& llvm::orc::SymbolLookupSet::append ( SymbolLookupSet  Other)
inline

Quickly append one lookup set to another.

Definition at line 243 of file Core.h.

References move, and Other.

◆ begin() [1/2]

iterator llvm::orc::SymbolLookupSet::begin ( )
inline

Definition at line 252 of file Core.h.

Referenced by remove().

◆ begin() [2/2]

const_iterator llvm::orc::SymbolLookupSet::begin ( ) const
inline

Definition at line 254 of file Core.h.

◆ containsDuplicates()

bool llvm::orc::SymbolLookupSet::containsDuplicates ( )
inline

Returns true if this set contains any duplicates.

This should only be used in assertions.

Definition at line 367 of file Core.h.

References I, and sortByAddress().

Referenced by llvm::orc::CtorDtorRunner::run().

◆ empty()

bool llvm::orc::SymbolLookupSet::empty ( ) const
inline

Definition at line 250 of file Core.h.

◆ end() [1/2]

iterator llvm::orc::SymbolLookupSet::end ( )
inline

Definition at line 253 of file Core.h.

◆ end() [2/2]

const_iterator llvm::orc::SymbolLookupSet::end ( ) const
inline

Definition at line 255 of file Core.h.

◆ forEachWithRemoval() [1/2]

template<typename BodyFn >
auto llvm::orc::SymbolLookupSet::forEachWithRemoval ( BodyFn &&  Body) -> std::enable_if_t< std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(), std::declval<SymbolLookupFlags>())), bool>::value>
inline

Loop over the elements of this SymbolLookupSet, applying the Body function to each one.

Body must be callable as bool(const SymbolStringPtr &, SymbolLookupFlags). If Body returns true then the element just passed in is removed from the set. If Body returns false then the element is retained.

Definition at line 287 of file Core.h.

References I, and remove().

◆ forEachWithRemoval() [2/2]

template<typename BodyFn >
auto llvm::orc::SymbolLookupSet::forEachWithRemoval ( BodyFn &&  Body) -> std::enable_if_t< std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(), std::declval<SymbolLookupFlags>())), Expected<bool>>::value, Error>
inline

Loop over the elements of this SymbolLookupSet, applying the Body function to each one.

Body must be callable as Expected<bool>(const SymbolStringPtr &, SymbolLookupFlags). If Body returns a failure value, the loop exits immediately. If Body returns true then the element just passed in is removed from the set. If Body returns false then the element is retained.

Definition at line 309 of file Core.h.

References I, remove(), and llvm::Error::success().

◆ fromMapKeys()

template<typename KeyT >
static SymbolLookupSet llvm::orc::SymbolLookupSet::fromMapKeys ( const DenseMap< SymbolStringPtr, KeyT > &  M,
SymbolLookupFlags  Flags = SymbolLookupFlags::RequiredSymbol 
)
inlinestatic

Construct a SymbolLookupSet from DenseMap keys.

Definition at line 224 of file Core.h.

References M.

Referenced by llvm::orc::ExecutionSession::registerJITDispatchHandlers().

◆ getSymbolNames()

SymbolNameVector llvm::orc::SymbolLookupSet::getSymbolNames ( ) const
inline

Construct a SymbolNameVector from this instance by dropping the Flags values.

Definition at line 331 of file Core.h.

◆ remove() [1/2]

void llvm::orc::SymbolLookupSet::remove ( iterator  I)
inline

Removes the element pointed to by the given iterator.

This iterator and all subsequent ones (including end()) are invalidated.

Definition at line 265 of file Core.h.

References begin(), I, and remove().

Referenced by remove().

◆ remove() [2/2]

void llvm::orc::SymbolLookupSet::remove ( UnderlyingVector::size_type  I)
inline

Removes the Ith element of the vector, replacing it with the last element.

Definition at line 258 of file Core.h.

References I, and std::swap().

Referenced by forEachWithRemoval(), and remove_if().

◆ remove_if()

template<typename PredFn >
void llvm::orc::SymbolLookupSet::remove_if ( PredFn &&  Pred)
inline

Removes all elements matching the given predicate, which must be callable as bool(const SymbolStringPtr &, SymbolLookupFlags Flags).

Definition at line 269 of file Core.h.

References I, and remove().

◆ removeDuplicates()

void llvm::orc::SymbolLookupSet::removeDuplicates ( )
inline

Remove any duplicate elements.

If a SymbolLookupSet is not duplicate-free by construction, this method can be used to turn it into a proper set.

Definition at line 358 of file Core.h.

References sortByAddress(), and llvm::unique().

◆ size()

UnderlyingVector::size_type llvm::orc::SymbolLookupSet::size ( ) const
inline

◆ sortByAddress()

void llvm::orc::SymbolLookupSet::sortByAddress ( )
inline

Sort the lookup set by pointer value.

This sort is fast but sensitive to allocation order and so should not be used where a consistent order is required.

Definition at line 342 of file Core.h.

References llvm::sort().

Referenced by containsDuplicates(), and removeDuplicates().

◆ sortByName()

void llvm::orc::SymbolLookupSet::sortByName ( )
inline

Sort the lookup set lexicographically.

This sort is slow but the order is unaffected by allocation order.

Definition at line 350 of file Core.h.

References llvm::sort().


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