[Lldb-commits] [PATCH] D40635: refactor: Simplify loop with DWARFCompileUnit::Extract

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 29 21:48:26 PST 2017


jankratochvil created this revision.
Herald added a subscriber: JDevlieghere.

Forgotten small simplification in https://reviews.llvm.org/D40212.


https://reviews.llvm.org/D40635

Files:
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp


Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -97,12 +97,8 @@
   if (m_compile_units.empty()) {
     if (m_dwarf2Data != NULL) {
       lldb::offset_t offset = 0;
-      for (;;) {
-        DWARFCompileUnitSP cu_sp =
-            DWARFCompileUnit::Extract(m_dwarf2Data, &offset);
-        if (cu_sp.get() == NULL)
-          break;
-
+      DWARFCompileUnitSP cu_sp;
+      while ((cu_sp = DWARFCompileUnit::Extract(m_dwarf2Data, &offset))) {
         m_compile_units.push_back(cu_sp);
 
         offset = cu_sp->GetNextCompileUnitOffset();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40635.124871.patch
Type: text/x-patch
Size: 734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171130/0c12948f/attachment.bin>


More information about the lldb-commits mailing list