Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions llvm/include/llvm/IR/DebugInfoMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -2600,14 +2600,23 @@ class DILocation : public MDNode {
StringRef getDirectory() const { return getScope()->getDirectory(); }
std::optional<StringRef> getSource() const { return getScope()->getSource(); }

/// Get the location where this is inlined
///
/// Walk through \a getInlinedAt() and return the \a DILocation where this is
/// inlined.
const DILocation *getInlinedAtLocation() const {
const DILocation *Current = this, *Next = nullptr;
while (Next = Current->getInlinedAt())
Current = Next;
return Current;
}

/// Get the scope where this is inlined.
///
/// Walk through \a getInlinedAt() and return \a getScope() from the deepest
/// location.
DILocalScope *getInlinedAtScope() const {
if (auto *IA = getInlinedAt())
return IA->getInlinedAtScope();
return getScope();
return getInlinedAtLocation()->getScope();
}

/// Get the DWARF discriminator.
Expand Down
Loading