mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
DebugInfo: Implement MDLocation::getInlinedAtScope()
Write `MDLocation::getInlinedAtScope()` and use it to re-implement `DebugLoc::getScopeNode()` (and simplify `DISubprogram::Verify()`). This follows the inlined-at linked list and returns the scope of the deepest/last location. llvm-svn: 233568
This commit is contained in:
parent
2772e933dc
commit
40f848db2f
@ -949,6 +949,16 @@ public:
|
|||||||
return cast_or_null<MDLocation>(getRawInlinedAt());
|
return cast_or_null<MDLocation>(getRawInlinedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Get the scope where this is inlined.
|
||||||
|
///
|
||||||
|
/// Walk through \a getInlinedAt() and return \a getScope() from the deepest
|
||||||
|
/// location.
|
||||||
|
MDLocalScope *getInlinedAtScope() const {
|
||||||
|
if (auto *IA = getInlinedAt())
|
||||||
|
return IA->getInlinedAtScope();
|
||||||
|
return getScope();
|
||||||
|
}
|
||||||
|
|
||||||
Metadata *getRawScope() const { return getOperand(0); }
|
Metadata *getRawScope() const { return getOperand(0); }
|
||||||
Metadata *getRawInlinedAt() const {
|
Metadata *getRawInlinedAt() const {
|
||||||
if (getNumOperands() == 2)
|
if (getNumOperands() == 2)
|
||||||
|
@ -349,9 +349,7 @@ bool DISubprogram::Verify() const {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// walk the inlined-at scopes
|
// walk the inlined-at scopes
|
||||||
while (MDLocation *IA = DL->getInlinedAt())
|
MDScope *Scope = DL->getInlinedAtScope();
|
||||||
DL = IA;
|
|
||||||
MDScope *Scope = DL->getScope();
|
|
||||||
if (!Scope)
|
if (!Scope)
|
||||||
return false;
|
return false;
|
||||||
while (!isa<MDSubprogram>(Scope)) {
|
while (!isa<MDSubprogram>(Scope)) {
|
||||||
|
@ -33,9 +33,7 @@ void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MDNode *DebugLoc::getScopeNode() const {
|
MDNode *DebugLoc::getScopeNode() const {
|
||||||
if (MDNode *InlinedAt = getInlinedAt())
|
return cast<MDLocation>(Loc)->getInlinedAtScope();
|
||||||
return DebugLoc::getFromDILocation(InlinedAt).getScopeNode();
|
|
||||||
return getScope();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLoc DebugLoc::getFnDebugLoc() const {
|
DebugLoc DebugLoc::getFnDebugLoc() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user