LLVM 22.0.0git
llvm::cas::ObjectRef Class Reference

Reference to an object in an ObjectStore instance. More...

#include "llvm/CAS/CASReference.h"

Inheritance diagram for llvm::cas::ObjectRef:
[legend]

Public Member Functions

void print (raw_ostream &OS) const
 Print internal ref and/or CASID. Only suitable for debugging.
LLVM_DUMP_METHOD void dump () const
Public Member Functions inherited from llvm::cas::ReferenceBase
uint64_t getInternalRef (const ObjectStore &ExpectedCAS) const
 Get an internal reference.
unsigned getDenseMapHash () const
 Helper functions for DenseMapInfo.
bool isDenseMapEmpty () const
bool isDenseMapTombstone () const
bool isDenseMapSentinel () const

Static Public Member Functions

static ObjectRef getDenseMapEmptyKey ()
static ObjectRef getDenseMapTombstoneKey ()

Friends

class ObjectStore
class ReferenceBase
bool operator== (const ObjectRef &LHS, const ObjectRef &RHS)
bool operator!= (const ObjectRef &LHS, const ObjectRef &RHS)

Additional Inherited Members

Protected Member Functions inherited from llvm::cas::ReferenceBase
void print (raw_ostream &OS, const ObjectHandle &This) const
void print (raw_ostream &OS, const ObjectRef &This) const
bool hasSameInternalRef (const ReferenceBase &RHS) const
 ReferenceBase (const ObjectStore *CAS, uint64_t InternalRef, bool IsHandle)
 ReferenceBase (DenseMapEmptyTag)
 ReferenceBase (DenseMapTombstoneTag)
Static Protected Member Functions inherited from llvm::cas::ReferenceBase
static constexpr uint64_t getDenseMapEmptyRef ()
static constexpr uint64_t getDenseMapTombstoneRef ()

Detailed Description

Reference to an object in an ObjectStore instance.

If you have an ObjectRef, you know the object exists, and you can point at it from new nodes with ObjectStore::store(), but you don't know anything about it. "Loading" the object is a separate step that may not have happened yet, and which can fail (due to filesystem corruption) or introduce latency (if downloading from a remote store).

ObjectStore::store() takes a list of these, and these are returned by ObjectStore::forEachRef() and ObjectStore::readRef(), which are accessors for nodes, and ObjectStore::getReference().

ObjectStore::load() will load the referenced object, and returns ObjectHandle, a variant that knows what kind of entity it is. ObjectStore::getReferenceKind() can expect the type of reference without asking for unloaded objects to be loaded.

Definition at line 108 of file CASReference.h.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void ObjectRef::dump ( ) const

Definition at line 24 of file ObjectStore.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ getDenseMapEmptyKey()

ObjectRef llvm::cas::ObjectRef::getDenseMapEmptyKey ( )
inlinestatic

Definition at line 119 of file CASReference.h.

Referenced by llvm::DenseMapInfo< cas::ObjectRef >::getEmptyKey().

◆ getDenseMapTombstoneKey()

ObjectRef llvm::cas::ObjectRef::getDenseMapTombstoneKey ( )
inlinestatic

◆ print()

void llvm::cas::ObjectRef::print ( raw_ostream & OS) const
inline

Print internal ref and/or CASID. Only suitable for debugging.

Definition at line 127 of file CASReference.h.

References llvm::cas::ReferenceBase::print().

Referenced by dump().

◆ ObjectStore

friend class ObjectStore
friend

Definition at line 132 of file CASReference.h.

References ObjectStore.

Referenced by ObjectStore, and ReferenceBase.

◆ operator!=

bool operator!= ( const ObjectRef & LHS,
const ObjectRef & RHS )
friend

Definition at line 115 of file CASReference.h.

References LHS, and RHS.

◆ operator==

bool operator== ( const ObjectRef & LHS,
const ObjectRef & RHS )
friend

Definition at line 112 of file CASReference.h.

References LHS, and RHS.

◆ ReferenceBase

friend class ReferenceBase
friend

Definition at line 133 of file CASReference.h.

References ObjectStore, ReferenceBase, and llvm::cas::ReferenceBase::ReferenceBase().

Referenced by ReferenceBase.


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