class AssertingVH

Declaration

template <typename ValueTy>
class AssertingVH { /* full declaration omitted */ };

Description

Value handle that asserts if the Value is deleted. This is a Value Handle that points to a value and asserts out if the value is destroyed while the handle is still live. This is very useful for catching dangling pointer bugs and other things which can be non-obvious. One particularly useful place to use this is as the Key of a map. Dangling pointer bugs often lead to really subtle bugs that only occur if another object happens to get allocated to the same address as the old one. Using an AssertingVH ensures that an assert is triggered as soon as the bad delete occurs. Note that an AssertingVH handle does *not* follow values across RAUW operations. This means that RAUW's need to explicitly update the AssertingVH's as it moves. This is required because in non-assert mode this class turns into a trivial wrapper around a pointer.

Declared at: llvm/include/llvm/IR/ValueHandle.h:260

Templates

ValueTy

Member Variables

private llvm::Value* ThePtr

Method Overview

Methods

AssertingVH<ValueTy>()

Declared at: llvm/include/llvm/IR/ValueHandle.h:288

AssertingVH<ValueTy>(ValueTy* P)

Declared at: llvm/include/llvm/IR/ValueHandle.h:289

Parameters

ValueTy* P

AssertingVH<ValueTy>(const AssertingVH<ValueTy>&)

Declared at: llvm/include/llvm/IR/ValueHandle.h:290

Parameters

const AssertingVH<ValueTy>&

static llvm::Value* GetAsValue(llvm::Value* V)

Declared at: llvm/include/llvm/IR/ValueHandle.h:276

Parameters

llvm::Value* V

static llvm::Value* GetAsValue(
    const llvm::Value* V)

Declared at: llvm/include/llvm/IR/ValueHandle.h:277

Parameters

const llvm::Value* V

llvm::Value* getRawValPtr() const

Declared at: llvm/include/llvm/IR/ValueHandle.h:272

ValueTy* getValPtr() const

Declared at: llvm/include/llvm/IR/ValueHandle.h:279

ValueTy* operator type - parameter - 0 -
    0 *() const

Declared at: llvm/include/llvm/IR/ValueHandle.h:293

void setRawValPtr(llvm::Value* P)

Declared at: llvm/include/llvm/IR/ValueHandle.h:273

Parameters

llvm::Value* P

void setValPtr(ValueTy* P)

Declared at: llvm/include/llvm/IR/ValueHandle.h:280

Parameters

ValueTy* P