Code style change as suggested in https://reviews.llvm.org/D32177 (NFC)
authorDehao Chen <dehao@google.com>
Wed, 19 Apr 2017 20:52:21 +0000 (20:52 +0000)
committerDehao Chen <dehao@google.com>
Wed, 19 Apr 2017 20:52:21 +0000 (20:52 +0000)
llvm-svn: 300753

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

index f76b917..c3f4677 100644 (file)
@@ -387,24 +387,19 @@ DWARFDie DWARFUnit::getSubroutineForAddress(uint64_t Address) {
 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,