From 3add73fd57c6ffbfff56d4bf5cba1fe5fec4321e Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Wed, 3 Jul 2024 15:54:48 -0700 Subject: [PATCH] Refine includes needed. * source_location: Only include in preprocessor branches that need it. * testbench: looks like it included some headers not needed anymore. * A few more of these here and there, all pointed out by clang-tidy misc-include-cleaner PiperOrigin-RevId: 649223641 --- xls/common/BUILD | 1 - xls/common/source_location.h | 5 +---- xls/interpreter/BUILD | 1 - xls/interpreter/block_evaluator.cc | 1 - xls/interpreter/block_evaluator.h | 4 ---- xls/ir/big_int.h | 3 ++- xls/ir/instantiation.cc | 1 - xls/ir/instantiation.h | 1 - xls/jit/BUILD | 2 -- xls/jit/block_jit.cc | 3 --- xls/jit/block_jit.h | 3 --- xls/modules/aes/sample_generator.cc | 1 + xls/protected/netlist.h | 2 ++ xls/simulation/verilog_test_base.h | 2 +- xls/tools/BUILD | 2 -- xls/tools/testbench.h | 3 --- 16 files changed, 7 insertions(+), 28 deletions(-) diff --git a/xls/common/BUILD b/xls/common/BUILD index d43eaf42f1..5d773b0d4b 100644 --- a/xls/common/BUILD +++ b/xls/common/BUILD @@ -250,7 +250,6 @@ cc_test( cc_library( name = "source_location", hdrs = ["source_location.h"], - deps = ["@com_google_absl//absl/base:config"], ) cc_test( diff --git a/xls/common/source_location.h b/xls/common/source_location.h index a208b2601d..f663010730 100644 --- a/xls/common/source_location.h +++ b/xls/common/source_location.h @@ -29,10 +29,6 @@ #ifndef XLS_COMMON_SOURCE_LOCATION_H_ #define XLS_COMMON_SOURCE_LOCATION_H_ -#include - -#include "absl/base/config.h" - #ifdef XLS_USE_ABSL_SOURCE_LOCATION #include "absl/types/source_location.h" @@ -44,6 +40,7 @@ using SourceLocation = absl::SourceLocation; } // namespace xabsl #else +#include // OSS Version of source_location diff --git a/xls/interpreter/BUILD b/xls/interpreter/BUILD index 764d720894..cac7f1e03a 100644 --- a/xls/interpreter/BUILD +++ b/xls/interpreter/BUILD @@ -200,7 +200,6 @@ cc_library( "//xls/ir", "//xls/ir:bits", "//xls/ir:channel", - "//xls/ir:elaboration", "//xls/ir:format_preference", "//xls/ir:function_builder", "//xls/ir:ir_test_base", diff --git a/xls/interpreter/block_evaluator.cc b/xls/interpreter/block_evaluator.cc index 585782ef94..0f8a53f85f 100644 --- a/xls/interpreter/block_evaluator.cc +++ b/xls/interpreter/block_evaluator.cc @@ -41,7 +41,6 @@ #include "xls/ir/block.h" #include "xls/ir/block_elaboration.h" #include "xls/ir/elaboration.h" -#include "xls/ir/events.h" #include "xls/ir/instantiation.h" #include "xls/ir/node.h" #include "xls/ir/nodes.h" diff --git a/xls/interpreter/block_evaluator.h b/xls/interpreter/block_evaluator.h index fca6aa1587..7ea37ac653 100644 --- a/xls/interpreter/block_evaluator.h +++ b/xls/interpreter/block_evaluator.h @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include "absl/container/flat_hash_map.h" @@ -30,8 +28,6 @@ #include "absl/status/statusor.h" #include "absl/types/span.h" #include "xls/codegen/module_signature.pb.h" -#include "xls/common/status/ret_check.h" -#include "xls/common/status/status_macros.h" #include "xls/ir/block.h" #include "xls/ir/block_elaboration.h" #include "xls/ir/events.h" diff --git a/xls/ir/big_int.h b/xls/ir/big_int.h index f0f117f844..5aada9dfe5 100644 --- a/xls/ir/big_int.h +++ b/xls/ir/big_int.h @@ -21,7 +21,8 @@ #include #include "absl/status/statusor.h" -#include "openssl/bn.h" +#include "openssl/base.h" +#include "openssl/bn.h" // IWYU pragma: keep #include "xls/ir/bits.h" namespace xls { diff --git a/xls/ir/instantiation.cc b/xls/ir/instantiation.cc index 8fcbc5d167..b1acbe9675 100644 --- a/xls/ir/instantiation.cc +++ b/xls/ir/instantiation.cc @@ -15,7 +15,6 @@ #include "xls/ir/instantiation.h" #include -#include #include #include #include diff --git a/xls/ir/instantiation.h b/xls/ir/instantiation.h index 1d79487a21..057de67ed8 100644 --- a/xls/ir/instantiation.h +++ b/xls/ir/instantiation.h @@ -21,7 +21,6 @@ #include #include -#include "absl/container/flat_hash_map.h" #include "absl/status/statusor.h" #include "xls/ir/channel.h" #include "xls/ir/package.h" diff --git a/xls/jit/BUILD b/xls/jit/BUILD index 21f5095fe9..2533e88fa2 100644 --- a/xls/jit/BUILD +++ b/xls/jit/BUILD @@ -697,7 +697,6 @@ cc_library( ":orc_jit", "//xls/codegen:block_inlining_pass", "//xls/codegen:codegen_pass", - "//xls/codegen:module_signature_cc_proto", "//xls/common/status:ret_check", "//xls/common/status:status_macros", "//xls/interpreter:block_evaluator", @@ -712,7 +711,6 @@ cc_library( "//xls/ir:value_utils", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", diff --git a/xls/jit/block_jit.cc b/xls/jit/block_jit.cc index 969e770d6e..1d122d6465 100644 --- a/xls/jit/block_jit.cc +++ b/xls/jit/block_jit.cc @@ -18,14 +18,12 @@ #include #include #include -#include #include #include #include #include #include "absl/container/flat_hash_map.h" -#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -33,7 +31,6 @@ #include "absl/types/span.h" #include "xls/codegen/block_inlining_pass.h" #include "xls/codegen/codegen_pass.h" -#include "xls/codegen/module_signature.pb.h" #include "xls/common/status/ret_check.h" #include "xls/common/status/status_macros.h" #include "xls/interpreter/block_evaluator.h" diff --git a/xls/jit/block_jit.h b/xls/jit/block_jit.h index db6357faf4..535d6e3ff4 100644 --- a/xls/jit/block_jit.h +++ b/xls/jit/block_jit.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -30,8 +29,6 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/span.h" -#include "xls/codegen/module_signature.pb.h" -#include "xls/common/status/status_macros.h" #include "xls/interpreter/block_evaluator.h" #include "xls/ir/block.h" #include "xls/ir/block_elaboration.h" diff --git a/xls/modules/aes/sample_generator.cc b/xls/modules/aes/sample_generator.cc index c1828f93a6..d1d3c2f63e 100644 --- a/xls/modules/aes/sample_generator.cc +++ b/xls/modules/aes/sample_generator.cc @@ -39,6 +39,7 @@ #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "openssl/aead.h" // NOLINT +#include "openssl/base.h" #include "xls/common/exit_status.h" #include "xls/common/init_xls.h" #include "xls/common/status/status_macros.h" diff --git a/xls/protected/netlist.h b/xls/protected/netlist.h index 87ff8013fb..544b5b8b82 100644 --- a/xls/protected/netlist.h +++ b/xls/protected/netlist.h @@ -22,11 +22,13 @@ #ifndef XLS_PROTECTED_NETLIST_H_ #define XLS_PROTECTED_NETLIST_H_ +// IWYU pragma: begin_exports #include "xls/netlist/cell_library.h" #include "xls/netlist/function_extractor.h" #include "xls/netlist/interpreter.h" #include "xls/netlist/lib_parser.h" #include "xls/netlist/netlist.h" #include "xls/netlist/netlist_parser.h" +// IWYU pragma: end_exports #endif // XLS_PROTECTED_NETLIST_H_ diff --git a/xls/simulation/verilog_test_base.h b/xls/simulation/verilog_test_base.h index f9568d102a..a23680d7c2 100644 --- a/xls/simulation/verilog_test_base.h +++ b/xls/simulation/verilog_test_base.h @@ -89,7 +89,7 @@ inline std::ostream& operator<<(std::ostream& os, const SimulationTarget& t) { return os; } -#include "xls/simulation/simulation_targets.inc" +#include "xls/simulation/simulation_targets.inc" // IWYU pragma: keep // Returns the name of the parameterized test from the Paramtype info. Use in // INSTANTIATE_TEST_SUITE_P invocation so tests have meaningful names (e.g., diff --git a/xls/tools/BUILD b/xls/tools/BUILD index 7eeee313a2..87e2be09eb 100644 --- a/xls/tools/BUILD +++ b/xls/tools/BUILD @@ -588,8 +588,6 @@ cc_library( hdrs = ["testbench.h"], deps = [ ":testbench_thread", - "//xls/common/file:filesystem", - "@com_google_absl//absl/base", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/status", "@com_google_absl//absl/strings:str_format", diff --git a/xls/tools/testbench.h b/xls/tools/testbench.h index 025c4b5897..33851162dc 100644 --- a/xls/tools/testbench.h +++ b/xls/tools/testbench.h @@ -20,18 +20,15 @@ #include #include #include -#include // NOLINT(build/c++11) #include #include -#include "absl/base/internal/sysinfo.h" #include "absl/base/thread_annotations.h" #include "absl/status/status.h" #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "xls/common/file/filesystem.h" #include "xls/tools/testbench_thread.h" namespace xls {