LLVM 20.0.0git
|
A debug info location. More...
#include "llvm/IR/DebugLoc.h"
Public Types | |
enum | { ReplaceLastInlinedAt = true } |
Static Public Member Functions | |
static DebugLoc | appendInlinedAt (const DebugLoc &DL, DILocation *InlinedAt, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &Cache) |
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-at the new call site. | |
static DebugLoc | replaceInlinedAtSubprogram (const DebugLoc &DL, DISubprogram &NewSP, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &Cache) |
Rebuild the entire inline-at chain by replacing the subprogram at the end of the chain with NewSP. | |
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 33 of file DebugLoc.h.
anonymous enum |
Enumerator | |
---|---|
ReplaceLastInlinedAt |
Definition at line 71 of file DebugLoc.h.
|
default |
Referenced by getFnDebugLoc().
DebugLoc::DebugLoc | ( | const DILocation * | L | ) |
Construct from an DILocation.
Definition at line 17 of file DebugLoc.cpp.
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 18 of file DebugLoc.cpp.
|
static |
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-at the new call site.
InlinedAt | The new outermost inlined-at in the chain. |
Definition at line 110 of file DebugLoc.cpp.
References DL, llvm::MDNode::getDistinct(), llvm::Last, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::reverse().
Referenced by inlineDebugLoc().
LLVM_DUMP_METHOD void DebugLoc::dump | ( | ) | const |
Definition at line 140 of file DebugLoc.cpp.
References llvm::dbgs(), and print().
DILocation * DebugLoc::get | ( | ) | const |
Get the underlying DILocation.
isa<DILocation>(getAsMDNode())
. Definition at line 20 of file DebugLoc.cpp.
References llvm::TypedTrackingMDRef< T >::get().
Referenced by llvm::addLocationToRemarks(), llvm::ConvertDebugDeclareToDebugValue(), fixupLineNumbers(), llvm::formatCallSiteLocation(), getCol(), getInlinedAt(), getLine(), getScope(), insertDbgValueOrDbgVariableRecord(), insertDbgValueOrDbgVariableRecordAfter(), isImplicitCode(), operator DILocation *(), operator*(), operator->(), llvm::DebugInfoFinder::processDbgRecord(), and setImplicitCode().
|
inline |
Return this
as a bar MDNode.
Definition at line 106 of file DebugLoc.h.
Referenced by llvm::Instruction::eraseMetadataIf(), and llvm::Instruction::getMetadata().
unsigned DebugLoc::getCol | ( | ) | const |
Definition at line 29 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), inlineDebugLoc(), print(), and llvm::MachineBasicBlock::SplitCriticalEdge().
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 48 of file DebugLoc.cpp.
References DebugLoc(), llvm::MDNode::get(), llvm::getDISubprogram(), and getInlinedAtScope().
DILocation * DebugLoc::getInlinedAt | ( | ) | const |
Definition at line 39 of file DebugLoc.cpp.
References assert(), and get().
Referenced by findVarsWithStackSlot(), fixupDebugInfoPostExtraction(), getAggregate(), getAggregateVariable(), llvm::getDebugValueLoc(), llvm::SelectionDAGBuilder::handleDebugValue(), llvm::DroppedVariableStats::populateVarIDSetAndInlinedMap(), and print().
MDNode * DebugLoc::getInlinedAtScope | ( | ) | const |
Get the fully inlined-at scope for a DebugLoc.
Gets the inlined-at scope for a DebugLoc.
Definition at line 44 of file DebugLoc.cpp.
Referenced by getFnDebugLoc().
unsigned DebugLoc::getLine | ( | ) | const |
Definition at line 24 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), functionHasLines(), llvm::SampleProfileLoaderBaseImpl< FT >::getInstWeightImpl(), inlineDebugLoc(), print(), and llvm::MachineBasicBlock::SplitCriticalEdge().
MDNode * DebugLoc::getScope | ( | ) | const |
Definition at line 34 of file DebugLoc.cpp.
References assert(), and get().
Referenced by llvm::DwarfDebug::beginInstruction(), llvm::getDebugValueLoc(), inlineDebugLoc(), and print().
|
inline |
Check whether this has a trivial destructor.
Definition at line 69 of file DebugLoc.h.
References llvm::TypedTrackingMDRef< T >::hasTrivialDestructor().
Referenced by llvm::SDNode::SDNode().
bool DebugLoc::isImplicitCode | ( | ) | const |
Check if the DebugLoc corresponds to an implicit code.
Definition at line 57 of file DebugLoc.cpp.
References get().
|
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 66 of file DebugLoc.h.
|
inline |
Definition at line 55 of file DebugLoc.h.
References get().
Definition at line 113 of file DebugLoc.h.
References DL.
|
inline |
Definition at line 57 of file DebugLoc.h.
References get().
|
inline |
Definition at line 56 of file DebugLoc.h.
References get().
Definition at line 112 of file DebugLoc.h.
References DL.
void DebugLoc::print | ( | raw_ostream & | OS | ) | const |
prints source location /path/to/file.exe:line:col @[inlined at]
Definition at line 143 of file DebugLoc.cpp.
References getCol(), getInlinedAt(), getLine(), getScope(), and OS.
Referenced by dump().
|
static |
Rebuild the entire inline-at chain by replacing the subprogram at the end of the chain with NewSP.
Definition at line 70 of file DebugLoc.cpp.
References llvm::DILocalScope::cloneScopeForSubprogram(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::MDNode::get(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::reverse().
Referenced by fixupDebugInfoPostExtraction().
void DebugLoc::setImplicitCode | ( | bool | ImplicitCode | ) |
Definition at line 64 of file DebugLoc.cpp.
References get().