public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 03/17] Remove IS_ENUM_CLASS from cooked_index_flag
Date: Wed, 17 Jan 2024 09:39:31 -0700	[thread overview]
Message-ID: <20240117-debug-names-fix-v2-3-dbd5971a9c31@tromey.com> (raw)
In-Reply-To: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com>

I noticed that cooked_index_flag::IS_ENUM_CLASS is not needed.  This
patch removes it.
---
 gdb/dwarf2/cooked-index.c |  1 -
 gdb/dwarf2/cooked-index.h |  8 +++-----
 gdb/dwarf2/read.c         | 14 ++++++++------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index e4f112b6ee0..f15ae9c28df 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -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),
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index ebaed04753c..691a027704a 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -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);
 
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 84cbc1ac9af..cac194df617 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -4517,6 +4517,7 @@ class cooked_indexer
 				   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;
 

-- 
2.43.0


  parent reply	other threads:[~2024-01-17 16:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 16:39 [PATCH v2 00/17] Rewrite .debug_names reader and writer Tom Tromey
2024-01-17 16:39 ` [PATCH v2 01/17] Refactor 'maint set dwarf synchronous' handling Tom Tromey
2024-01-17 16:39 ` [PATCH v2 02/17] Refactor quick-function installation in DWARF reader Tom Tromey
2024-01-17 16:39 ` Tom Tromey [this message]
2024-01-17 16:39 ` [PATCH v2 04/17] Document GDB extensions to DWARF .debug_names Tom Tromey
2024-01-17 16:39 ` [PATCH v2 05/17] Add language to cooked_index_entry Tom Tromey
2024-01-17 16:39 ` [PATCH v2 06/17] Move cooked_index_functions to cooked-index.h Tom Tromey
2024-01-17 16:39 ` [PATCH v2 07/17] Do not write the index cache from an index Tom Tromey
2024-01-17 16:39 ` [PATCH v2 08/17] Change cooked_index_worker to abstract base class Tom Tromey
2024-01-17 16:39 ` [PATCH v2 09/17] Remove cooked_index_worker::start_reading Tom Tromey
2024-01-17 16:39 ` [PATCH v2 10/17] Empty hash table fix in .debug_names reader Tom Tromey
2024-01-17 16:39 ` [PATCH v2 11/17] Fix dw2-zero-range.exp when an index is in use Tom Tromey
2024-01-17 16:39 ` [PATCH v2 12/17] Explicitly expand CUs in dw2-inline-with-lexical-scope.exp Tom Tromey
2024-01-17 16:39 ` [PATCH v2 13/17] Remove some .debug_names tests Tom Tromey
2024-01-17 16:39 ` [PATCH v2 14/17] Allow other results in DW_TAG_entry_point test Tom Tromey
2024-01-17 16:39 ` [PATCH v2 15/17] Rewrite .debug_names reader Tom Tromey
2024-01-17 16:39 ` [PATCH v2 16/17] Export dwarf5_augmentation Tom Tromey
2024-01-17 16:39 ` [PATCH v2 17/17] Rewrite .debug_names writer Tom Tromey
2024-01-18 10:05 ` [PATCH v2 00/17] Rewrite .debug_names reader and writer Tom de Vries
2024-01-18 15:42   ` Tom Tromey
2024-01-18 20:33     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240117-debug-names-fix-v2-3-dbd5971a9c31@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).