]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf2: cleanup includes
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 29 Aug 2024 16:31:31 +0000 (12:31 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 30 Aug 2024 17:57:11 +0000 (13:57 -0400)
Cleanup includes in dwarf2/*.

 1. Add the necessary includes so that clangd reports no errors when
    opening header files.  This ensures that header files include what
    they use.

 2. Remove all includes reported as unused by clangd (except
    gdb-safe-ctype.h, which I think does some magic that affects what
    follows).

Built-tested --enable-threading at "yes" and "no", since there are some
portions of code gated by `#ifdef CXX_STD_THREAD`.

Change-Id: I21debffcd7c2caf90f08e1e0fbba3ce30422d042
Approved-By: Tom Tromey <tom@tromey.com>
19 files changed:
gdb/dwarf2/abbrev-cache.c
gdb/dwarf2/abbrev.c
gdb/dwarf2/abbrev.h
gdb/dwarf2/attribute.h
gdb/dwarf2/cooked-index.c
gdb/dwarf2/cooked-index.h
gdb/dwarf2/dwz.h
gdb/dwarf2/frame-tailcall.c
gdb/dwarf2/frame.c
gdb/dwarf2/index-cache.c
gdb/dwarf2/index-cache.h
gdb/dwarf2/index-write.c
gdb/dwarf2/line-header.h
gdb/dwarf2/loc.c
gdb/dwarf2/macro.h
gdb/dwarf2/mapped-index.h
gdb/dwarf2/parent-map.h
gdb/dwarf2/read.c
gdb/dwarf2/read.h

index b87206c2c4eec13c6add0509cc321090bd3ccf2d..7e1ff9ceb15dc2c86baf6d0d8b5680e6b7dfd2d0 100644 (file)
@@ -17,7 +17,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "dwarf2/read.h"
 #include "dwarf2/abbrev-cache.h"
 
 /* Hash function for an abbrev table.  */
index 359a0094872acc4443f7f500cdc917737b7c231a..bae8d8b3bed5dcff5af893cbc24a0a0d987ccac1 100644 (file)
@@ -24,9 +24,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "dwarf2/read.h"
 #include "dwarf2/abbrev.h"
 #include "dwarf2/leb.h"
+#include "dwarf2/section.h"
 #include "bfd.h"
 
 /* Hash function for an abbrev.  */
index 1fb90fdeafa42ba4183b8e5a7c77d87a9542240d..7eda95179dab911da8023f9e10c20b9552c887f7 100644 (file)
 #ifndef GDB_DWARF2_ABBREV_H
 #define GDB_DWARF2_ABBREV_H
 
+#include "dwarf2.h"
+#include "gdbsupport/gdb-hashtab.h"
+#include "gdbsupport/gdb_obstack.h"
 #include "hashtab.h"
+#include "types.h"
 
 struct attr_abbrev
 {
index 3b971adbe2a7ddab265eb2c192800150f907b30a..115d006e27175c426832c45850dc9a33e443acf8 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "dwarf2.h"
 #include "dwarf2/types.h"
-#include <optional>
 
 /* Blocks are a bunch of untyped bytes.  */
 struct dwarf_block
index c9e46af32aed1267c8b4506ea3f0953b5a60c0f7..41aa9d0da5842213d2def15a449cfc02f4891fa7 100644 (file)
@@ -24,6 +24,7 @@
 #include "cp-support.h"
 #include "c-lang.h"
 #include "ada-lang.h"
+#include "dwarf2/tag.h"
 #include "event-top.h"
 #include "exceptions.h"
 #include "split-name.h"
@@ -32,6 +33,8 @@
 #include <algorithm>
 #include "gdbsupport/gdb-safe-ctype.h"
 #include "gdbsupport/selftest.h"
+#include "gdbsupport/task-group.h"
+#include "gdbsupport/thread-pool.h"
 #include <chrono>
 #include <unordered_set>
 #include "cli/cli-cmds.h"
index fa8b2fc7ec7c9846ce5947c286c1c5937d9c0805..e9f13c97be09b64cfb48c7f8f6342e81d0b395dc 100644 (file)
 #include "dwarf2/types.h"
 #include "symtab.h"
 #include "hashtab.h"
-#include "dwarf2/index-common.h"
-#include <string_view>
 #include "quick-symbol.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "addrmap.h"
 #include "gdbsupport/iterator-range.h"
-#include "gdbsupport/thread-pool.h"
 #include "dwarf2/mapped-index.h"
 #include "dwarf2/read.h"
-#include "dwarf2/tag.h"
 #include "dwarf2/abbrev-cache.h"
 #include "dwarf2/parent-map.h"
 #include "gdbsupport/range-chain.h"
-#include "gdbsupport/task-group.h"
 #include "complaints.h"
-#include "run-on-main-thread.h"
 
 #if CXX_STD_THREAD
 #include <mutex>
index 5e6c1fa93a9263d538b666df535e831ea64c94a4..3ec3af1a8196c5715096fbc27b373d5082b0287c 100644 (file)
@@ -25,6 +25,7 @@
 #include "dwarf2/section.h"
 
 struct dwarf2_per_bfd;
+struct dwarf2_per_objfile;
 
 /* This represents a '.dwz' file.  */
 
index c48906822742fc25ccd7254b4ebc94f714c244c2..6ecf8a0b15d5addfbdf9ec69f90df48c8094b95d 100644 (file)
@@ -22,9 +22,7 @@
 #include "dwarf2/frame-tailcall.h"
 #include "dwarf2/loc.h"
 #include "frame-unwind.h"
-#include "block.h"
 #include "hashtab.h"
-#include "gdbtypes.h"
 #include "regcache.h"
 #include "value.h"
 #include "dwarf2/frame.h"
index 9ebf3ac4ac47bd1b5aad6b5b2434de406925284f..79ef065bfcbe007fe40919d744fd664b7a41dd9c 100644 (file)
@@ -25,7 +25,6 @@
 #include "frame.h"
 #include "frame-base.h"
 #include "frame-unwind.h"
-#include "gdbcore.h"
 #include "gdbtypes.h"
 #include "symtab.h"
 #include "objfiles.h"
@@ -37,7 +36,6 @@
 #include "dwarf2/frame.h"
 #include "dwarf2/read.h"
 #include "dwarf2/public.h"
-#include "ax.h"
 #include "dwarf2/loc.h"
 #include "dwarf2/frame-tailcall.h"
 #include "gdbsupport/gdb_binary_search.h"
index c11b0164aa4e46f0cc902a1910869aa602b7765e..a04d5d662d883f582064c7df17e76b8b619d9a58 100644 (file)
@@ -28,8 +28,6 @@
 #include "dwarf2/index-write.h"
 #include "dwarf2/read.h"
 #include "dwarf2/dwz.h"
-#include "objfiles.h"
-#include "gdbsupport/selftest.h"
 #include <string>
 #include <stdlib.h>
 #include "run-on-main-thread.h"
index 95f217ed961c758cdc7dd542d97dbc5526f06df5..08a2d56493c7831a527a5f7505e2400a18b0c763 100644 (file)
@@ -20,9 +20,7 @@
 #ifndef DWARF_INDEX_CACHE_H
 #define DWARF_INDEX_CACHE_H
 
-#include "dwarf2/index-common.h"
 #include "gdbsupport/array-view.h"
-#include "symfile.h"
 
 class dwarf2_per_bfd;
 class index_cache;
index 2a50e3b6c2de08b33d2b2e79721680379cd6e851..a845d87871517c22f7dd848d0032a84bdad18364 100644 (file)
@@ -28,7 +28,6 @@
 #include "gdbsupport/gdb_unlinker.h"
 #include "gdbsupport/pathstuff.h"
 #include "gdbsupport/scoped_fd.h"
-#include "complaints.h"
 #include "dwarf2/index-common.h"
 #include "dwarf2/cooked-index.h"
 #include "dwarf2.h"
@@ -44,9 +43,7 @@
 
 #include <algorithm>
 #include <cmath>
-#include <forward_list>
 #include <map>
-#include <set>
 #include <unordered_map>
 #include <unordered_set>
 
index c068dff70a3f2f84530f99225a90a517fd768287..7da59725c98b7f713fcce335e28213d9b1aa4a2b 100644 (file)
 #ifndef DWARF2_LINE_HEADER_H
 #define DWARF2_LINE_HEADER_H
 
+#include "dwarf2/types.h"
+
+struct dwarf2_per_objfile;
+
 /* dir_index is 1-based in DWARF 4 and before, and is 0-based in DWARF 5 and
    later.  */
 typedef int dir_index;
index 80c86bb850f7b8f6899cb56ee86aa69bef19903e..3a47805ab3ad01fae7c66b3dcbf23269fddc32b6 100644 (file)
@@ -41,7 +41,6 @@
 #include "dwarf2/frame.h"
 #include "dwarf2/leb.h"
 #include "compile/compile.h"
-#include "gdbsupport/selftest.h"
 #include <algorithm>
 #include <vector>
 #include <unordered_set>
index 586f5d5ee9a3ca337d8ba6bba116c07956fa6e0b..7ef2134b3a27fe8f51a39d0895eb84a9ab8310e8 100644 (file)
@@ -21,6 +21,8 @@
 #define GDB_DWARF2_MACRO_H
 
 struct buildsym_compunit;
+struct dwarf2_per_objfile;
+struct dwarf2_section_info;
 
 extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
                                 buildsym_compunit *builder,
index b4f6483ea92cffd78732b27e4c8de41228631ec2..e7dd8e925077b925a0530e84a8ca6ccd4e9e1aa4 100644 (file)
@@ -20,7 +20,9 @@
 #ifndef GDB_DWARF2_MAPPED_INDEX_H
 #define GDB_DWARF2_MAPPED_INDEX_H
 
+#include "dwarf2/index-common.h"
 #include "language.h"
+#include "quick-symbol.h"
 
 /* An index into a (C++) symbol name component in a symbol name as
    recorded in the mapped_index's symbol table.  For each C++ symbol
index f070d505356d6e4a3dbac378f9873305e807506c..5a94bd9beffea2f2762b1cbf77ec5d7df9a0487e 100644 (file)
@@ -20,7 +20,9 @@
 #ifndef GDB_DWARF2_PARENT_MAP_H
 #define GDB_DWARF2_PARENT_MAP_H
 
-#include <algorithm>
+#include "addrmap.h"
+#include "dwarf2/types.h"
+#include "gdbsupport/gdb_obstack.h"
 
 class cooked_index_entry;
 
index 6c503c6294101cd57708983584e7cc07c52689c8..769ca91faccf3d4efcf08eaf0a213e0436935760 100644 (file)
@@ -48,6 +48,7 @@
 #include "bfd.h"
 #include "elf-bfd.h"
 #include "event-top.h"
+#include "gdbsupport/task-group.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "objfiles.h"
@@ -70,7 +71,6 @@
 #include "go-lang.h"
 #include "valprint.h"
 #include "gdbcore.h"
-#include "gdb/gdb-index.h"
 #include "gdb_bfd.h"
 #include "f-lang.h"
 #include "source.h"
@@ -92,7 +92,6 @@
 #include <unordered_set>
 #include "dwarf2/abbrev-cache.h"
 #include "cooked-index.h"
-#include "split-name.h"
 #include "gdbsupport/thread-pool.h"
 #include "run-on-main-thread.h"
 #include "dwarf2/parent-map.h"
index 40e1f555b772731b69ae36d0c4511054dde2d536..b23972b7a4e8cc1dc6be828da7658947a26a5190 100644 (file)
@@ -28,7 +28,6 @@
 #include "dwarf2/mapped-index.h"
 #include "dwarf2/section.h"
 #include "dwarf2/cu.h"
-#include "filename-seen-cache.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "gdbsupport/hash_enum.h"
 #include "gdbsupport/function-view.h"