LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::MDAttachments Class Reference

Multimap-like storage for metadata attachments. More...

#include "IR/LLVMContextImpl.h"

Classes

struct  Attachment
 

Public Member Functions

bool empty () const
 
size_t size () const
 
MDNodelookup (unsigned ID) const
 Returns the first attachment with the given ID or nullptr if no such attachment exists.
 
void get (unsigned ID, SmallVectorImpl< MDNode * > &Result) const
 Appends all attachments with the given ID to Result in insertion order.
 
void getAll (SmallVectorImpl< std::pair< unsigned, MDNode * > > &Result) const
 Appends all attachments for the global to Result, sorting by attachment ID.
 
void set (unsigned ID, MDNode *MD)
 Set an attachment to a particular node.
 
void insert (unsigned ID, MDNode &MD)
 Adds an attachment to a particular node.
 
bool erase (unsigned ID)
 Remove attachments with the given ID.
 
template<class PredTy >
void remove_if (PredTy shouldRemove)
 Erase matching attachments.
 

Detailed Description

Multimap-like storage for metadata attachments.

Definition at line 1405 of file LLVMContextImpl.h.

Member Function Documentation

◆ empty()

bool llvm::MDAttachments::empty ( ) const
inline

Definition at line 1416 of file LLVMContextImpl.h.

References llvm::SmallVectorBase< Size_T >::empty().

Referenced by erase().

◆ erase()

bool MDAttachments::erase ( unsigned  ID)

Remove attachments with the given ID.

Remove the attachments at ID, if any.

Definition at line 1445 of file Metadata.cpp.

References A, empty(), and llvm::erase_if().

Referenced by set().

◆ get()

void MDAttachments::get ( unsigned  ID,
SmallVectorImpl< MDNode * > &  Result 
) const

Appends all attachments with the given ID to Result in insertion order.

If the global has no attachments with the given ID, or if ID is invalid, leaves Result unchanged.

Definition at line 1418 of file Metadata.cpp.

References A.

◆ getAll()

void MDAttachments::getAll ( SmallVectorImpl< std::pair< unsigned, MDNode * > > &  Result) const

Appends all attachments for the global to Result, sorting by attachment ID.

Attachments with the same ID appear in insertion order. This function does not clear Result.

Definition at line 1424 of file Metadata.cpp.

References A, and llvm::stable_sort().

◆ insert()

void MDAttachments::insert ( unsigned  ID,
MDNode MD 
)

Adds an attachment to a particular node.

Definition at line 1441 of file Metadata.cpp.

Referenced by set().

◆ lookup()

MDNode * MDAttachments::lookup ( unsigned  ID) const

Returns the first attachment with the given ID or nullptr if no such attachment exists.

Definition at line 1411 of file Metadata.cpp.

References A.

Referenced by llvm::Value::getMetadataImpl().

◆ remove_if()

template<class PredTy >
void llvm::MDAttachments::remove_if ( PredTy  shouldRemove)
inline

Erase matching attachments.

Erases all attachments matching the shouldRemove predicate.

Definition at line 1450 of file LLVMContextImpl.h.

References llvm::erase_if().

◆ set()

void MDAttachments::set ( unsigned  ID,
MDNode MD 
)

Set an attachment to a particular node.

Set the ID attachment to MD, replacing the current attachments at ID (if anyway).

Definition at line 1435 of file Metadata.cpp.

References erase(), and insert().

◆ size()

size_t llvm::MDAttachments::size ( ) const
inline

Definition at line 1417 of file LLVMContextImpl.h.

References llvm::SmallVectorBase< Size_T >::size().


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