void
DWARFUnit::getInlinedChainForAddress(uint64_t Address,
SmallVectorImpl<DWARFDie> &InlinedChain) {
- // First, find the subroutine that contains the given address (the leaf
- // of inlined chain).
- DWARFDie SubroutineDIE;
+ assert(InlinedChain.empty());
// Try to look for subprogram DIEs in the DWO file.
parseDWO();
- if (DWO)
- SubroutineDIE = DWO->getUnit()->getSubroutineForAddress(Address);
- else
- SubroutineDIE = getSubroutineForAddress(Address);
-
- if (SubroutineDIE) {
- while (SubroutineDIE) {
- if (SubroutineDIE.isSubroutineDIE())
- InlinedChain.push_back(SubroutineDIE);
- SubroutineDIE = SubroutineDIE.getParent();
- }
- } else
- InlinedChain.clear();
+ // First, find the subroutine that contains the given address (the leaf
+ // of inlined chain).
+ DWARFDie SubroutineDIE =
+ (DWO ? DWO->getUnit() : this)->getSubroutineForAddress(Address);
+
+ while (SubroutineDIE) {
+ if (SubroutineDIE.isSubroutineDIE())
+ InlinedChain.push_back(SubroutineDIE);
+ SubroutineDIE = SubroutineDIE.getParent();
+ }
}
const DWARFUnitIndex &llvm::getDWARFUnitIndex(DWARFContext &Context,