LLVM  14.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. More...
 
void get (unsigned ID, SmallVectorImpl< MDNode * > &Result) const
 Appends all attachments with the given ID to Result in insertion order. More...
 
void getAll (SmallVectorImpl< std::pair< unsigned, MDNode * >> &Result) const
 Appends all attachments for the global to Result, sorting by attachment ID. More...
 
void set (unsigned ID, MDNode *MD)
 Set an attachment to a particular node. More...
 
void insert (unsigned ID, MDNode &MD)
 Adds an attachment to a particular node. More...
 
bool erase (unsigned ID)
 Remove attachments with the given ID. More...
 
template<class PredTy >
void remove_if (PredTy shouldRemove)
 Erase matching attachments. More...
 

Detailed Description

Multimap-like storage for metadata attachments.

Definition at line 1291 of file LLVMContextImpl.h.

Member Function Documentation

◆ empty()

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

Definition at line 1302 of file LLVMContextImpl.h.

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 1181 of file Metadata.cpp.

References 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 1154 of file Metadata.cpp.

◆ 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 1160 of file Metadata.cpp.

References llvm::stable_sort().

◆ insert()

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

Adds an attachment to a particular node.

Definition at line 1177 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 1147 of file Metadata.cpp.

◆ 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 1336 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 1171 of file Metadata.cpp.

References erase(), and insert().

◆ size()

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

Definition at line 1303 of file LLVMContextImpl.h.


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