[llvm] [DebugInfo] Helper method for finding the deepest inlining location (PR #161696)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 03:53:59 PDT 2025
================
@@ -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;
----------------
OCHyams wrote:
```suggestion
const DILocation *Current = this
while (const DILocation *Next = Current->getInlinedAt())
Current = Next;
return Current;
```
nit - I think this is a bit neater, what do you think? (and as a side note I would personally avoid multiple variable declarations on the same line).
https://github.com/llvm/llvm-project/pull/161696
More information about the llvm-commits
mailing list