LLVM API Documentation

llvm::AssertingVH< ValueTy > Class Template Reference

#include <ValueHandle.h>

Inheritance diagram for llvm::AssertingVH< ValueTy >:
[legend]
Collaboration diagram for llvm::AssertingVH< ValueTy >:
[legend]

List of all members.

Public Member Functions

 AssertingVH ()
 AssertingVH (ValueTy *P)
 AssertingVH (const AssertingVH &RHS)
 operator ValueTy * () const
ValueTy * operator= (ValueTy *RHS)
ValueTy * operator= (AssertingVH< ValueTy > &RHS)
ValueTy * operator-> () const
ValueTy & operator* () const


Detailed Description

template<typename ValueTy>
class llvm::AssertingVH< ValueTy >

AssertingVH - 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.

Definition at line 163 of file ValueHandle.h.


Constructor & Destructor Documentation

template<typename ValueTy>
llvm::AssertingVH< ValueTy >::AssertingVH (  )  [inline]

Definition at line 189 of file ValueHandle.h.

template<typename ValueTy>
llvm::AssertingVH< ValueTy >::AssertingVH ( ValueTy *  P  )  [inline]

Definition at line 190 of file ValueHandle.h.

template<typename ValueTy>
llvm::AssertingVH< ValueTy >::AssertingVH ( const AssertingVH< ValueTy > &  RHS  )  [inline]

Definition at line 191 of file ValueHandle.h.


Member Function Documentation

template<typename ValueTy>
llvm::AssertingVH< ValueTy >::operator ValueTy * (  )  const [inline]

Definition at line 197 of file ValueHandle.h.

template<typename ValueTy>
ValueTy* llvm::AssertingVH< ValueTy >::operator= ( ValueTy *  RHS  )  [inline]

Definition at line 201 of file ValueHandle.h.

template<typename ValueTy>
ValueTy* llvm::AssertingVH< ValueTy >::operator= ( AssertingVH< ValueTy > &  RHS  )  [inline]

Definition at line 205 of file ValueHandle.h.

References llvm::AssertingVH< ValueTy >::getValPtr().

template<typename ValueTy>
ValueTy* llvm::AssertingVH< ValueTy >::operator-> (  )  const [inline]

Reimplemented from llvm::ValueHandleBase.

Definition at line 210 of file ValueHandle.h.

template<typename ValueTy>
ValueTy& llvm::AssertingVH< ValueTy >::operator* (  )  const [inline]

Reimplemented from llvm::ValueHandleBase.

Definition at line 211 of file ValueHandle.h.


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