LLVM  4.0.0
Public Member Functions | Static Public Member Functions | List of all members
llvm::DebugLoc Class Reference

A debug info location. More...

#include <DebugLoc.h>

Public Member Functions

 DebugLoc ()=default
 
 DebugLoc (const DILocation *L)
 Construct from an DILocation. More...
 
 DebugLoc (const MDNode *N)
 Construct from an MDNode. More...
 
 operator bool () const
 Check for null. More...
 
bool hasTrivialDestructor () const
 Check whether this has a trivial destructor. More...
 
unsigned getLine () const
 
unsigned getCol () const
 
MDNodegetScope () const
 
DILocationgetInlinedAt () const
 
MDNodegetInlinedAtScope () const
 Get the fully inlined-at scope for a DebugLoc. More...
 
DebugLoc getFnDebugLoc () const
 Find the debug info location for the start of the function. More...
 
MDNodegetAsMDNode () const
 Return this as a bar MDNode. More...
 
bool operator== (const DebugLoc &DL) const
 
bool operator!= (const DebugLoc &DL) const
 
void dump () const
 
void print (raw_ostream &OS) const
 prints source location /path/to/file.exe:line:col @[inlined at] More...
 
DILocationget () const
 Get the underlying DILocation. More...
 
 operator DILocation * () const
 
DILocationoperator-> () const
 
DILocationoperator* () const
 

Static Public Member Functions

static DebugLoc get (unsigned Line, unsigned Col, const MDNode *Scope, const MDNode *InlinedAt=nullptr)
 Create a new DebugLoc. More...
 

Detailed Description

A debug info location.

This class is a wrapper around a tracking reference to an DILocation pointer.

To avoid extra includes, DebugLoc doubles the DILocation API with a one based on relatively opaque MDNode pointers.

Definition at line 34 of file DebugLoc.h.

Constructor & Destructor Documentation

llvm::DebugLoc::DebugLoc ( )
default

Referenced by dump(), get(), and getFnDebugLoc().

DebugLoc::DebugLoc ( const DILocation L)

Construct from an DILocation.

Definition at line 18 of file DebugLoc.cpp.

DebugLoc::DebugLoc ( const MDNode N)
explicit

Construct from an MDNode.

Note: if N is not an DILocation, a verifier check will fail, and accessors will crash. However, construction from other nodes is supported in order to handle forward references when reading textual IR.

Definition at line 19 of file DebugLoc.cpp.

Member Function Documentation

LLVM_DUMP_METHOD void DebugLoc::dump ( ) const

Definition at line 69 of file DebugLoc.cpp.

References llvm::dbgs(), DebugLoc(), getCol(), getInlinedAt(), and getLine().

DILocation * DebugLoc::get ( ) const

Get the underlying DILocation.

Precondition
!*this or isa<DILocation>(getAsMDNode()).

Definition at line 21 of file DebugLoc.cpp.

References llvm::TypedTrackingMDRef< T >::get().

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::X86FrameLowering::adjustForSegmentedStacks(), llvm::DiagnosticInfoOptimizationBase::Argument::Argument(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::MSP430FrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::AVRFrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::MSP430FrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), emitThumb1LoadConstPool(), getFnDebugLoc(), llvm::PPCRegisterInfo::lowerCRBitRestore(), llvm::PPCRegisterInfo::lowerCRBitSpilling(), llvm::PPCRegisterInfo::lowerCRRestore(), llvm::PPCRegisterInfo::lowerCRSpilling(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), llvm::PPCRegisterInfo::lowerVRSAVERestore(), llvm::PPCRegisterInfo::lowerVRSAVESpilling(), llvm::X86FrameLowering::processFunctionBeforeFrameFinalized(), llvm::AVRFrameLowering::restoreCalleeSavedRegisters(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::X86FrameLowering::restoreWin32EHStackPointers(), llvm::InsertNOPLoad::runOnMachineFunction(), llvm::FixFSMULD::runOnMachineFunction(), llvm::ReplaceFMULS::runOnMachineFunction(), llvm::FixAllFDIVSQRT::runOnMachineFunction(), llvm::AVRDynAllocaSR::runOnMachineFunction(), llvm::AVRFrameLowering::spillCalleeSavedRegisters(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), llvm::stripNonLineTableDebugInfo(), and updateInlinedAtInfo().

DebugLoc DebugLoc::get ( unsigned  Line,
unsigned  Col,
const MDNode Scope,
const MDNode InlinedAt = nullptr 
)
static

Create a new DebugLoc.

Create a new DebugLoc at the specified line/col and scope/inline. This forwards to DILocation::get().

If !Scope, returns a default-constructed DebugLoc.

FIXME: Remove this. Users should use DILocation::get().

Definition at line 58 of file DebugLoc.cpp.

References DebugLoc(), llvm::MDNode::get(), and llvm::MDNode::getContext().

MDNode* llvm::DebugLoc::getAsMDNode ( ) const
inline

Return this as a bar MDNode.

Definition at line 103 of file DebugLoc.h.

unsigned DebugLoc::getCol ( ) const
DebugLoc DebugLoc::getFnDebugLoc ( ) const

Find the debug info location for the start of the function.

Walk up the scope chain of given debug loc and find line number info for the function.

FIXME: Remove this. Users should use DILocation/DILocalScope API to find the subprogram, and then DILocation::get().

Definition at line 49 of file DebugLoc.cpp.

References DebugLoc(), get(), llvm::getDISubprogram(), and getInlinedAtScope().

Referenced by llvm::CodeViewDebug::beginFunction().

DILocation * DebugLoc::getInlinedAt ( ) const

Definition at line 40 of file DebugLoc.cpp.

References assert().

Referenced by dump(), print(), and printDebugLoc().

MDNode * DebugLoc::getInlinedAtScope ( ) const

Get the fully inlined-at scope for a DebugLoc.

Gets the inlined-at scope for a DebugLoc.

Definition at line 45 of file DebugLoc.cpp.

Referenced by getFnDebugLoc().

unsigned DebugLoc::getLine ( ) const
MDNode * DebugLoc::getScope ( ) const
bool llvm::DebugLoc::hasTrivialDestructor ( ) const
inline

Check whether this has a trivial destructor.

Definition at line 70 of file DebugLoc.h.

References llvm::TypedTrackingMDRef< T >::hasTrivialDestructor().

Referenced by llvm::SDNode::SDNode(), and llvm::MachineInstr::setDebugLoc().

llvm::DebugLoc::operator bool ( ) const
inlineexplicit

Check for null.

Check for null in a way that is safe with broken debug info. Unlike the conversion to DILocation, this doesn't require that Loc is of the right type. Important for cases like llvm::StripDebugInfo() and Instruction::hasMetadata().

Definition at line 67 of file DebugLoc.h.

llvm::DebugLoc::operator DILocation * ( ) const
inline

Definition at line 56 of file DebugLoc.h.

bool llvm::DebugLoc::operator!= ( const DebugLoc DL) const
inline

Definition at line 106 of file DebugLoc.h.

DILocation& llvm::DebugLoc::operator* ( ) const
inline

Definition at line 58 of file DebugLoc.h.

DILocation* llvm::DebugLoc::operator-> ( ) const
inline

Definition at line 57 of file DebugLoc.h.

bool llvm::DebugLoc::operator== ( const DebugLoc DL) const
inline

Definition at line 105 of file DebugLoc.h.

void DebugLoc::print ( raw_ostream OS) const

prints source location /path/to/file.exe:line:col @[inlined at]

Definition at line 85 of file DebugLoc.cpp.

References getCol(), getInlinedAt(), getLine(), and getScope().

Referenced by llvm::MachineInstr::print().


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