LLVM 19.0.0git
Public Types | Static Public Member Functions | List of all members
llvm::MetadataTracking Class Reference

API for tracking metadata references through RAUW and deletion. More...

#include "llvm/IR/Metadata.h"

Public Types

using OwnerTy = PointerUnion< MetadataAsValue *, Metadata *, DebugValueUser * >
 

Static Public Member Functions

static bool track (Metadata *&MD)
 Track the reference to metadata.
 
static bool track (void *Ref, Metadata &MD, Metadata &Owner)
 Track the reference to metadata for Metadata.
 
static bool track (void *Ref, Metadata &MD, MetadataAsValue &Owner)
 Track the reference to metadata for MetadataAsValue.
 
static bool track (void *Ref, Metadata &MD, DebugValueUser &Owner)
 Track the reference to metadata for DebugValueUser.
 
static void untrack (Metadata *&MD)
 Stop tracking a reference to metadata.
 
static void untrack (void *Ref, Metadata &MD)
 
static bool retrack (Metadata *&MD, Metadata *&New)
 Move tracking from one reference to another.
 
static bool retrack (void *Ref, Metadata &MD, void *New)
 
static bool isReplaceable (const Metadata &MD)
 Check whether metadata is replaceable.
 

Detailed Description

API for tracking metadata references through RAUW and deletion.

Shared API for updating Metadata pointers in subclasses that support RAUW.

This API is not meant to be used directly. See TrackingMDRef for a user-friendly tracking reference.

Definition at line 304 of file Metadata.h.

Member Typedef Documentation

◆ OwnerTy

Definition at line 368 of file Metadata.h.

Member Function Documentation

◆ isReplaceable()

bool MetadataTracking::isReplaceable ( const Metadata MD)
static

Check whether metadata is replaceable.

Definition at line 244 of file Metadata.cpp.

Referenced by llvm::TrackingMDRef::hasTrivialDestructor(), and retrack().

◆ retrack() [1/2]

static bool llvm::MetadataTracking::retrack ( Metadata *&  MD,
Metadata *&  New 
)
inlinestatic

Move tracking from one reference to another.

Semantically equivalent to untrack(MD) followed by track(New), except that ownership callbacks are maintained.

Note: it is an error if *MD does not equal New.

Returns
true iff tracking is supported by MD.

Definition at line 360 of file Metadata.h.

References retrack().

Referenced by llvm::MDOperand::MDOperand(), llvm::MDOperand::operator=(), and retrack().

◆ retrack() [2/2]

bool MetadataTracking::retrack ( void *  Ref,
Metadata MD,
void *  New 
)
static

Definition at line 229 of file Metadata.cpp.

References assert(), isReplaceable(), and llvm::Ref.

◆ track() [1/4]

static bool llvm::MetadataTracking::track ( Metadata *&  MD)
inlinestatic

Track the reference to metadata.

Register MD with *MD, if the subclass supports tracking. If *MD gets RAUW'ed, MD will be updated to the new address. If *MD gets deleted, MD will be set to nullptr.

If tracking isn't supported, *MD will not change.

Returns
true iff tracking is supported by MD.

Definition at line 315 of file Metadata.h.

References track().

Referenced by llvm::ReplaceableMetadataImpl::replaceAllUsesWith(), llvm::DistinctMDOperandPlaceholder::replaceUseWith(), and track().

◆ track() [2/4]

static bool llvm::MetadataTracking::track ( void *  Ref,
Metadata MD,
DebugValueUser Owner 
)
inlinestatic

Track the reference to metadata for DebugValueUser.

As track(Metadata*&), but with support for calling back to Owner to tell it that its operand changed. This could trigger Owner being re-uniqued.

Definition at line 342 of file Metadata.h.

References llvm::Ref, and track().

◆ track() [3/4]

static bool llvm::MetadataTracking::track ( void *  Ref,
Metadata MD,
Metadata Owner 
)
inlinestatic

Track the reference to metadata for Metadata.

As track(Metadata*&), but with support for calling back to Owner to tell it that its operand changed. This could trigger Owner being re-uniqued.

Definition at line 324 of file Metadata.h.

References llvm::Ref, and track().

◆ track() [4/4]

static bool llvm::MetadataTracking::track ( void *  Ref,
Metadata MD,
MetadataAsValue Owner 
)
inlinestatic

Track the reference to metadata for MetadataAsValue.

As track(Metadata*&), but with support for calling back to Owner to tell it that its operand changed. This could trigger Owner being re-uniqued.

Definition at line 333 of file Metadata.h.

References llvm::Ref, and track().

◆ untrack() [1/2]

static void llvm::MetadataTracking::untrack ( Metadata *&  MD)
inlinestatic

Stop tracking a reference to metadata.

Stops *MD from tracking MD.

Definition at line 349 of file Metadata.h.

References untrack().

Referenced by llvm::DistinctMDOperandPlaceholder::replaceUseWith(), and untrack().

◆ untrack() [2/2]

void MetadataTracking::untrack ( void *  Ref,
Metadata MD 
)
static

Definition at line 221 of file Metadata.cpp.

References assert(), and llvm::Ref.


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