From dbfbbbc97422f8ff8757130f4963e579d9ce0072 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 27 Oct 2025 15:12:24 -0400 Subject: [PATCH] gdb/dwarf: make some fields of dwarf2_per_cu private The comments on these fields mention that they should be private, but we can't. I think this comes from the time where dwarf2_per_cu was and had to remain POD. I don't think it's relevant anymore, there are other private fields anyway. Make them private. Change-Id: I1915ea531f42d685f68ff547833816906f79cd58 Approved-By: Tom Tromey --- gdb/dwarf2/read.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index f0d46f6acc6..d0d8f1a3a0e 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -187,12 +187,11 @@ public: any of the current compilation units are processed. */ packed queued; - /* True if HEADER has been read in. - - Don't access this field directly. It should be private, but we can't make - it private at the moment. */ +private: + /* True if HEADER has been read in. */ mutable packed m_header_read_in; +public: /* True if we've tried to read the file table. There will be no point in trying to read it again next time. */ packed files_read; @@ -229,15 +228,14 @@ public: /* Backlink to the owner of this. */ dwarf2_per_bfd *per_bfd; +private: /* DWARF header of this unit. Note that dwarf2_cu reads its own version of the header, which may differ from this one, since it may pass rch_kind::TYPE to read_unit_head, whereas for dwarf2_per_cu we always pass - ruh_kind::COMPILE. - - Don't access this field directly, use the get_header method instead. It - should be private, but we can't make it private at the moment. */ + ruh_kind::COMPILE. */ mutable unit_head m_header; +public: /* The file and directory for this CU. This is cached so that we don't need to re-examine the DWO in some situations. This may be nullptr, depending on the CU; for example a partial unit won't -- 2.47.3