LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::DbgVariable Class Reference

This class is used to track local variable information. More...

#include "CodeGen/AsmPrinter/DwarfDebug.h"

Inheritance diagram for llvm::DbgVariable:
Inheritance graph
[legend]

Public Member Functions

Loc::VariantasVariant ()
 To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the base class subobject needs to be passed directly to std::visit, so expose it directly here.
 
const Loc::VariantasVariant () const
 
template<typename T >
bool holds () const
 Member shorthand for std::holds_alternative.
 
template<typename T >
auto & get () noexcept
 Asserting, noexcept member alternative to std::get.
 
template<typename T >
const auto & get () const noexcept
 Asserting, noexcept member alternative to std::get.
 
 DbgVariable (const DILocalVariable *V, const DILocation *IA)
 Construct a DbgVariable.
 
const DILocalVariablegetVariable () const
 
StringRef getName () const
 
dwarf::Tag getTag () const
 
bool isArtificial () const
 Return true if DbgVariable is artificial.
 
bool isObjectPointer () const
 
const DITypegetType () const
 
- Public Member Functions inherited from llvm::DbgEntity
 DbgEntity (const DINode *N, const DILocation *IA, DbgEntityKind ID)
 
virtual ~DbgEntity ()=default
 
void setDIE (DIE &D)
 
const DINodegetEntity () const
 Accessors.
 
const DILocationgetInlinedAt () const
 
DIEgetDIE () const
 
DbgEntityKind getDbgEntityID () const
 

Static Public Member Functions

static bool classof (const DbgEntity *N)
 
- Static Public Member Functions inherited from llvm::DbgEntity
static bool classof (const DbgEntity *N)
 

Additional Inherited Members

- Public Types inherited from llvm::DbgEntity
enum  DbgEntityKind { DbgVariableKind , DbgLabelKind }
 

Detailed Description

This class is used to track local variable information.

Variables that have been optimized out hold the monostate alternative. This is not distinguished from the case of a constructed DbgVariable which has not be initialized yet.

Variables can be created from allocas, in which case they're generated from the MMI table. Such variables hold the Loc::MMI alternative which can have multiple expressions and frame indices.

Variables can be created from the entry value of registers, in which case they're generated from the MMI table. Such variables hold the EntryValueLoc alternative which can either have a single expression or multiple fragment expressions.

Variables can be created from DBG_VALUE instructions. Those whose location changes over time hold a Loc::Multi alternative which uses DebugLocListIndex and (optionally) DebugLocListTagOffset, while those with a single location hold a Loc::Single alternative which use ValueLoc and (optionally) a single Expr.

Definition at line 214 of file DwarfDebug.h.

Constructor & Destructor Documentation

◆ DbgVariable()

llvm::DbgVariable::DbgVariable ( const DILocalVariable V,
const DILocation IA 
)
inline

Construct a DbgVariable.

Creates a variable without any DW_AT_location.

Definition at line 242 of file DwarfDebug.h.

Member Function Documentation

◆ asVariant() [1/2]

Loc::Variant & llvm::DbgVariable::asVariant ( )
inline

To workaround P2162R0 https://github.com/cplusplus/papers/issues/873 the base class subobject needs to be passed directly to std::visit, so expose it directly here.

Definition at line 220 of file DwarfDebug.h.

Referenced by llvm::DwarfCompileUnit::constructVariableDIE().

◆ asVariant() [2/2]

const Loc::Variant & llvm::DbgVariable::asVariant ( ) const
inline

Definition at line 221 of file DwarfDebug.h.

◆ classof()

static bool llvm::DbgVariable::classof ( const DbgEntity N)
inlinestatic

Definition at line 280 of file DwarfDebug.h.

References llvm::DbgEntity::DbgVariableKind, and N.

◆ get() [1/2]

template<typename T >
const auto & llvm::DbgVariable::get ( ) const
inlinenoexcept

Asserting, noexcept member alternative to std::get.

Definition at line 234 of file DwarfDebug.h.

References assert().

◆ get() [2/2]

template<typename T >
auto & llvm::DbgVariable::get ( )
inlinenoexcept

Asserting, noexcept member alternative to std::get.

Definition at line 229 of file DwarfDebug.h.

References assert().

◆ getName()

StringRef llvm::DbgVariable::getName ( ) const
inline

◆ getTag()

dwarf::Tag llvm::DbgVariable::getTag ( ) const
inline

Definition at line 253 of file DwarfDebug.h.

References getVariable().

Referenced by llvm::DwarfCompileUnit::constructVariableDIE().

◆ getType()

const DIType * DbgVariable::getType ( ) const

◆ getVariable()

const DILocalVariable * llvm::DbgVariable::getVariable ( ) const
inline

◆ holds()

template<typename T >
bool llvm::DbgVariable::holds ( ) const
inline

Member shorthand for std::holds_alternative.

Definition at line 225 of file DwarfDebug.h.

◆ isArtificial()

bool llvm::DbgVariable::isArtificial ( ) const
inline

Return true if DbgVariable is artificial.

Definition at line 262 of file DwarfDebug.h.

References getType(), getVariable(), and isArtificial().

Referenced by llvm::DwarfCompileUnit::applyCommonDbgVariableAttributes(), and isArtificial().

◆ isObjectPointer()

bool llvm::DbgVariable::isObjectPointer ( ) const
inline

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