[Lldb-commits] [lldb] ca64f9a - [lldb][DWARFASTParserClang][NFC] Simplify unnamed bitfield condition

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue May 16 03:18:18 PDT 2023


Author: Michael Buch
Date: 2023-05-16T11:18:09+01:00
New Revision: ca64f9af04472a27656d84c06f4e332ebbf14b4d

URL: https://github.com/llvm/llvm-project/commit/ca64f9af04472a27656d84c06f4e332ebbf14b4d
DIFF: https://github.com/llvm/llvm-project/commit/ca64f9af04472a27656d84c06f4e332ebbf14b4d.diff

LOG: [lldb][DWARFASTParserClang][NFC] Simplify unnamed bitfield condition

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

Differential Revision: https://reviews.llvm.org/D150589

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 1090e15370dd2..7f67d25f58ae1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2880,9 +2880,8 @@ void DWARFASTParserClang::ParseSingleMember(
 
     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...
@@ -2902,10 +2901,8 @@ void DWARFASTParserClang::ParseSingleMember(
       // 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 =


        


More information about the lldb-commits mailing list