]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove IS_ENUM_CLASS from cooked_index_flag
authorTom Tromey <tom@tromey.com>
Sun, 3 Dec 2023 00:19:55 +0000 (17:19 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 18 Jan 2024 15:20:16 +0000 (08:20 -0700)
I noticed that cooked_index_flag::IS_ENUM_CLASS is not needed.  This
patch removes it.

gdb/dwarf2/cooked-index.c
gdb/dwarf2/cooked-index.h
gdb/dwarf2/read.c

index e4f112b6ee01fd418e74e66dcd33faa4df823679..f15ae9c28dfa22613938647f81b42041d3a8a3e7 100644 (file)
@@ -48,7 +48,6 @@ to_string (cooked_index_flag flags)
   static constexpr cooked_index_flag::string_mapping mapping[] = {
     MAP_ENUM_FLAG (IS_MAIN),
     MAP_ENUM_FLAG (IS_STATIC),
-    MAP_ENUM_FLAG (IS_ENUM_CLASS),
     MAP_ENUM_FLAG (IS_LINKAGE),
     MAP_ENUM_FLAG (IS_TYPE_DECLARATION),
     MAP_ENUM_FLAG (IS_PARENT_DEFERRED),
index ebaed04753c654f0b022f2b3552dc5951083c561..691a027704ae55c35f1363bd7775a1fb873f2ba2 100644 (file)
@@ -57,16 +57,14 @@ enum cooked_index_flag_enum : unsigned char
   IS_MAIN = 1,
   /* True if this entry represents a "static" object.  */
   IS_STATIC = 2,
-  /* True if this entry is an "enum class".  */
-  IS_ENUM_CLASS = 4,
   /* True if this entry uses the linkage name.  */
-  IS_LINKAGE = 8,
+  IS_LINKAGE = 4,
   /* True if this entry is just for the declaration of a type, not the
      definition.  */
-  IS_TYPE_DECLARATION = 16,
+  IS_TYPE_DECLARATION = 8,
   /* True is parent_entry.deferred has a value rather than parent_entry
      .resolved.  */
-  IS_PARENT_DEFERRED = 32,
+  IS_PARENT_DEFERRED = 16,
 };
 DEF_ENUM_FLAGS_TYPE (enum cooked_index_flag_enum, cooked_index_flag);
 
index 84cbc1ac9afe6249a8e86a802f6ce6d4e364b396..cac194df6170fa44eba5de10f66e0bd28abfa30d 100644 (file)
@@ -4517,6 +4517,7 @@ private:
                                   sect_offset *sibling_offset,
                                   const cooked_index_entry **parent_entry,
                                   CORE_ADDR *maybe_defer,
+                                  bool *is_enum_class,
                                   bool for_specification);
 
   /* Handle DW_TAG_imported_unit, by scanning the DIE to find
@@ -16162,6 +16163,7 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
                                 sect_offset *sibling_offset,
                                 const cooked_index_entry **parent_entry,
                                 CORE_ADDR *maybe_defer,
+                                bool *is_enum_class,
                                 bool for_specification)
 {
   bool origin_is_dwz = false;
@@ -16245,7 +16247,7 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
 
        case DW_AT_enum_class:
          if (attr.as_boolean ())
-           *flags |= IS_ENUM_CLASS;
+           *is_enum_class = true;
          break;
 
        case DW_AT_low_pc:
@@ -16355,7 +16357,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
          else
            scan_attributes (scanning_per_cu, new_reader, new_info_ptr,
                             new_info_ptr, new_abbrev, name, linkage_name,
-                            flags, nullptr, parent_entry, maybe_defer, true);
+                            flags, nullptr, parent_entry, maybe_defer,
+                            is_enum_class, true);
        }
     }
 
@@ -16507,6 +16510,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
       cooked_index_flag flags = IS_STATIC;
       sect_offset sibling {};
       const cooked_index_entry *this_parent_entry = parent_entry;
+      bool is_enum_class = false;
 
       /* The scope of a DW_TAG_entry_point cooked_index_entry is the one of
         its surrounding subroutine.  */
@@ -16515,7 +16519,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
       info_ptr = scan_attributes (reader->cu->per_cu, reader, info_ptr,
                                  info_ptr, abbrev, &name, &linkage_name,
                                  &flags, &sibling, &this_parent_entry,
-                                 &defer, false);
+                                 &defer, &is_enum_class, false);
 
       if (abbrev->tag == DW_TAG_namespace
          && m_language == language_cplus
@@ -16585,9 +16589,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
                 "enum_class::enumerator"; otherwise we inject the
                 names into our own parent scope.  */
              info_ptr = recurse (reader, info_ptr,
-                                 ((flags & IS_ENUM_CLASS) == 0)
-                                 ? parent_entry
-                                 : this_entry,
+                                 is_enum_class ? this_entry : parent_entry,
                                  fully);
              continue;