Skip to content

Commit

Permalink
Refine includes needed.
Browse files Browse the repository at this point in the history
 * 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
  • Loading branch information
hzeller authored and Copybara-Service committed Jul 3, 2024
1 parent 4fa1743 commit 3add73f
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 28 deletions.
1 change: 0 additions & 1 deletion xls/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ cc_test(
cc_library(
name = "source_location",
hdrs = ["source_location.h"],
deps = ["@com_google_absl//absl/base:config"],
)

cc_test(
Expand Down
5 changes: 1 addition & 4 deletions xls/common/source_location.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#ifndef XLS_COMMON_SOURCE_LOCATION_H_
#define XLS_COMMON_SOURCE_LOCATION_H_

#include <cstdint>

#include "absl/base/config.h"

#ifdef XLS_USE_ABSL_SOURCE_LOCATION
#include "absl/types/source_location.h"

Expand All @@ -44,6 +40,7 @@ using SourceLocation = absl::SourceLocation;
} // namespace xabsl

#else
#include <cstdint>

// OSS Version of source_location

Expand Down
1 change: 0 additions & 1 deletion xls/interpreter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion xls/interpreter/block_evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions xls/interpreter/block_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>

#include "absl/container/flat_hash_map.h"
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion xls/ir/big_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#include <tuple>

#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 {
Expand Down
1 change: 0 additions & 1 deletion xls/ir/instantiation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "xls/ir/instantiation.h"

#include <cstdint>
#include <initializer_list>
#include <optional>
#include <ostream>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion xls/ir/instantiation.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <string>
#include <string_view>

#include "absl/container/flat_hash_map.h"
#include "absl/status/statusor.h"
#include "xls/ir/channel.h"
#include "xls/ir/package.h"
Expand Down
2 changes: 0 additions & 2 deletions xls/jit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions xls/jit/block_jit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
#include <cstring>
#include <memory>
#include <optional>
#include <random>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#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"
#include "absl/strings/str_format.h"
#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"
Expand Down
3 changes: 0 additions & 3 deletions xls/jit/block_jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <cstdint>
#include <initializer_list>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions xls/modules/aes/sample_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions xls/protected/netlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
2 changes: 1 addition & 1 deletion xls/simulation/verilog_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.,
Expand Down
2 changes: 0 additions & 2 deletions xls/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions xls/tools/testbench.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@
#include <functional>
#include <iostream>
#include <memory>
#include <thread> // NOLINT(build/c++11)
#include <type_traits>
#include <vector>

#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 {
Expand Down

0 comments on commit 3add73f

Please sign in to comment.