[Lldb-commits] [PATCH] D150589: [lldb][DWARFASTParserClang][NFC] Simplify unnamed bitfield condition

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 15 09:50:48 PDT 2023


Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a reviewer: shafik.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Minor cleanup of redundant variable initialization and
if-condition. These are leftovers/oversights from previous
cleanup in this area:

- https://reviews.llvm.org/D72953
- https://reviews.llvm.org/D76808


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150589

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2881,9 +2881,8 @@
 
     if (detect_unnamed_bitfields) {
       std::optional<FieldInfo> unnamed_field_info;
-      uint64_t last_field_end = 0;
-
-      last_field_end = last_field_info.bit_offset + last_field_info.bit_size;
+      uint64_t last_field_end =
+          last_field_info.bit_offset + last_field_info.bit_size;
 
       if (!last_field_info.IsBitfield()) {
         // The last field was not a bit-field...
@@ -2903,10 +2902,8 @@
       // indeed an unnamed bit-field. We currently do not have the
       // machinary to track the offset of the last field of classes we
       // have seen before, so we are not handling this case.
-      if (this_field_info.bit_offset != last_field_end &&
-          this_field_info.bit_offset > last_field_end &&
-          !(last_field_info.bit_offset == 0 &&
-            last_field_info.bit_size == 0 &&
+      if (this_field_info.bit_offset > last_field_end &&
+          !(last_field_info.bit_offset == 0 && last_field_info.bit_size == 0 &&
             layout_info.base_offsets.size() != 0)) {
         unnamed_field_info = FieldInfo{};
         unnamed_field_info->bit_size =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150589.522235.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230515/4683a3f4/attachment-0001.bin>


More information about the lldb-commits mailing list