Skip to content

Commit 3b61ec9

Browse files
Merge pull request #1413 from hzeller:ir-fix-include
PiperOrigin-RevId: 634599228
2 parents 9a06d1d + fc87bf7 commit 3b61ec9

33 files changed

+102
-62
lines changed

xls/ir/BUILD

+16-1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ cc_test(
392392
":bits",
393393
":bits_ops",
394394
":bits_test_utils",
395+
":format_preference",
395396
":number_parser",
396397
":value",
397398
"//xls/common:bits_util",
@@ -611,11 +612,13 @@ cc_library(
611612
deps = [
612613
":channel",
613614
":channel_ops",
615+
":foreign_function_data_cc_proto",
614616
":format_strings",
615617
":ir",
616618
":op",
617619
":register",
618620
":source_location",
621+
":type",
619622
":value",
620623
":verifier",
621624
"//xls/common:casts",
@@ -646,6 +649,7 @@ cc_test(
646649
":ir_matcher",
647650
":node_util",
648651
":op",
652+
":register",
649653
":source_location",
650654
":type",
651655
":value",
@@ -917,10 +921,13 @@ cc_library(
917921
":bits",
918922
":type",
919923
":value",
924+
"//xls/common:bits_util",
920925
"//xls/common/status:ret_check",
921926
"//xls/common/status:status_macros",
922927
"//xls/data_structures:leaf_type_tree",
928+
"@com_google_absl//absl/base",
923929
"@com_google_absl//absl/log",
930+
"@com_google_absl//absl/log:check",
924931
"@com_google_absl//absl/status:statusor",
925932
"@com_google_absl//absl/strings",
926933
],
@@ -991,6 +998,7 @@ cc_test(
991998
name = "ir_test_base_test",
992999
srcs = ["ir_test_base_test.cc"],
9931000
deps = [
1001+
":ir",
9941002
":ir_test_base",
9951003
"//xls/common:xls_gunit_main",
9961004
"//xls/common/status:matchers",
@@ -1051,6 +1059,7 @@ cc_library(
10511059
hdrs = ["format_strings.h"],
10521060
deps = [
10531061
":format_preference",
1062+
"@com_google_absl//absl/status",
10541063
"@com_google_absl//absl/status:statusor",
10551064
"@com_google_absl//absl/strings",
10561065
"@com_google_absl//absl/strings:str_format",
@@ -1062,6 +1071,7 @@ cc_test(
10621071
name = "format_strings_test",
10631072
srcs = ["format_strings_test.cc"],
10641073
deps = [
1074+
":format_preference",
10651075
":format_strings",
10661076
"//xls/common:xls_gunit_main",
10671077
"//xls/common/status:matchers",
@@ -1208,6 +1218,7 @@ cc_library(
12081218
"//xls/common:string_to_int",
12091219
"//xls/common/status:ret_check",
12101220
"//xls/common/status:status_macros",
1221+
"@com_google_absl//absl/status",
12111222
"@com_google_absl//absl/status:statusor",
12121223
"@com_google_absl//absl/strings",
12131224
"@com_google_absl//absl/strings:str_format",
@@ -1283,6 +1294,7 @@ cc_test(
12831294
deps = [
12841295
":bits",
12851296
":bits_ops",
1297+
":format_preference",
12861298
":number_parser",
12871299
"//xls/common:xls_gunit_main",
12881300
"//xls/common/status:matchers",
@@ -1298,6 +1310,7 @@ cc_test(
12981310
":big_int",
12991311
":bits",
13001312
":bits_ops",
1313+
":format_preference",
13011314
":number_parser",
13021315
"//xls/common:xls_gunit_main",
13031316
"//xls/common/status:matchers",
@@ -1417,6 +1430,7 @@ cc_library(
14171430
"//xls/common/status:status_macros",
14181431
"@com_google_absl//absl/container:flat_hash_map",
14191432
"@com_google_absl//absl/log",
1433+
"@com_google_absl//absl/status",
14201434
"@com_google_absl//absl/status:statusor",
14211435
"@com_google_absl//absl/strings:str_format",
14221436
],
@@ -1594,6 +1608,7 @@ cc_test(
15941608
"//xls/common/status:matchers",
15951609
"//xls/common/status:ret_check",
15961610
"//xls/common/status:status_macros",
1611+
"@com_google_absl//absl/base",
15971612
"@com_google_absl//absl/status",
15981613
"@com_google_absl//absl/types:span",
15991614
"@com_google_googletest//:gtest",
@@ -1811,7 +1826,6 @@ cc_library(
18111826
"//xls/common/status:status_macros",
18121827
"@com_google_absl//absl/algorithm:container",
18131828
"@com_google_absl//absl/base:nullability",
1814-
"@com_google_absl//absl/container:btree",
18151829
"@com_google_absl//absl/container:flat_hash_map",
18161830
"@com_google_absl//absl/container:flat_hash_set",
18171831
"@com_google_absl//absl/log",
@@ -1852,6 +1866,7 @@ cc_library(
18521866
hdrs = ["proc_elaboration.h"],
18531867
deps = [
18541868
":channel",
1869+
":channel_cc_proto",
18551870
":channel_ops",
18561871
":elaboration",
18571872
":ir",

xls/ir/big_int_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "xls/common/status/matchers.h"
2727
#include "xls/ir/bits.h"
2828
#include "xls/ir/bits_ops.h"
29+
#include "xls/ir/format_preference.h"
2930
#include "xls/ir/number_parser.h"
3031

3132
namespace xls {

xls/ir/bits_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "xls/data_structures/inline_bitmap.h"
3535
#include "xls/ir/bits_ops.h"
3636
#include "xls/ir/bits_test_utils.h"
37+
#include "xls/ir/format_preference.h"
3738
#include "xls/ir/number_parser.h"
3839
#include "xls/ir/value.h"
3940

xls/ir/caret.cc

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "xls/common/file/filesystem.h"
3030
#include "xls/common/status/ret_check.h"
3131
#include "xls/common/status/status_macros.h"
32+
#include "xls/ir/fileno.h"
33+
#include "xls/ir/source_location.h"
3234

3335
namespace xls {
3436

xls/ir/caret_test.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "absl/strings/str_format.h"
2323
#include "xls/common/file/temp_file.h"
2424
#include "xls/common/status/matchers.h"
25+
#include "xls/ir/fileno.h"
2526
#include "xls/ir/package.h"
2627
#include "xls/ir/source_location.h"
2728

@@ -64,8 +65,8 @@ TEST(CaretTest, FileContent) {
6465
2 | this is a line of code that does stuff
6566
| ^
6667
)";
67-
std::string expected = absl::StrFormat(expected_format,
68-
std::string(temp_file.path()));
68+
std::string expected =
69+
absl::StrFormat(expected_format, std::string(temp_file.path()));
6970
EXPECT_EQ(
7071
PrintCaret(LookUpInPackage(&p), loc, std::nullopt, std::nullopt, 60),
7172
expected);

xls/ir/channel.cc

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "absl/types/variant.h"
3030
#include "google/protobuf/text_format.h"
3131
#include "xls/common/casts.h"
32+
#include "xls/ir/channel.pb.h"
3233
#include "xls/ir/channel_ops.h"
3334
#include "xls/ir/type.h"
3435
#include "xls/ir/value_utils.h"

xls/ir/format_strings.cc

+3
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@
1515
#include "xls/ir/format_strings.h"
1616

1717
#include <algorithm>
18+
#include <cstddef>
1819
#include <cstdint>
1920
#include <string>
2021
#include <string_view>
2122
#include <variant>
2223
#include <vector>
2324

25+
#include "absl/status/status.h"
2426
#include "absl/status/statusor.h"
2527
#include "absl/strings/str_cat.h"
2628
#include "absl/strings/str_format.h"
2729
#include "absl/strings/str_join.h"
2830
#include "absl/strings/str_replace.h"
2931
#include "absl/types/span.h"
32+
#include "xls/ir/format_preference.h"
3033

3134
namespace xls {
3235

xls/ir/format_strings_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "gtest/gtest.h"
2222
#include "absl/status/status.h"
2323
#include "xls/common/status/matchers.h"
24+
#include "xls/ir/format_preference.h"
2425

2526
namespace xls {
2627
namespace {

xls/ir/function.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ absl::StatusOr<Function*> Function::Clone(
9898

9999
// Clone parameters over first to maintain order.
100100
for (Param* param : (const_cast<Function*>(this))->params()) {
101-
XLS_ASSIGN_OR_RETURN(
102-
original_to_clone[param],
103-
param->CloneInNewFunction({}, cloned_function));
101+
XLS_ASSIGN_OR_RETURN(original_to_clone[param],
102+
param->CloneInNewFunction({}, cloned_function));
104103
}
105104
for (Node* node : TopoSort(const_cast<Function*>(this))) {
106105
if (node->Is<Param>()) { // Params were already copied.

xls/ir/function_builder.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@
3939
#include "xls/common/symbolized_stacktrace.h"
4040
#include "xls/ir/channel.h"
4141
#include "xls/ir/channel_ops.h"
42+
#include "xls/ir/foreign_function_data.pb.h"
4243
#include "xls/ir/format_strings.h"
4344
#include "xls/ir/function.h"
4445
#include "xls/ir/function_base.h"
46+
#include "xls/ir/lsb_or_msb.h"
4547
#include "xls/ir/nodes.h"
4648
#include "xls/ir/op.h"
4749
#include "xls/ir/package.h"
4850
#include "xls/ir/proc.h"
4951
#include "xls/ir/register.h"
5052
#include "xls/ir/source_location.h"
53+
#include "xls/ir/type.h"
5154
#include "xls/ir/value.h"
5255
#include "xls/ir/verifier.h"
5356
#include "xls/ir/verify_node.h"
@@ -215,8 +218,7 @@ BValue BuilderBase::OneHot(BValue input, LsbOrMsb priority,
215218

216219
BValue BuilderBase::OneHotSelect(BValue selector,
217220
absl::Span<const BValue> cases,
218-
const SourceInfo& loc,
219-
std::string_view name) {
221+
const SourceInfo& loc, std::string_view name) {
220222
if (ErrorPending()) {
221223
return BValue();
222224
}
@@ -1333,8 +1335,7 @@ BValue BuilderBase::AddBinOp(Op op, BValue lhs, BValue rhs,
13331335
}
13341336

13351337
BValue BuilderBase::AddCompareOp(Op op, BValue lhs, BValue rhs,
1336-
const SourceInfo& loc,
1337-
std::string_view name) {
1338+
const SourceInfo& loc, std::string_view name) {
13381339
if (ErrorPending()) {
13391340
return BValue();
13401341
}
@@ -1841,8 +1842,8 @@ absl::StatusOr<Block*> BlockBuilder::Build() {
18411842
}
18421843

18431844
BValue BlockBuilder::InstantiationInput(Instantiation* instantiation,
1844-
std::string_view port_name,
1845-
BValue data, const SourceInfo& loc,
1845+
std::string_view port_name, BValue data,
1846+
const SourceInfo& loc,
18461847
std::string_view name) {
18471848
if (ErrorPending()) {
18481849
return BValue();

xls/ir/function_builder_test.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "xls/ir/nodes.h"
3333
#include "xls/ir/op.h"
3434
#include "xls/ir/package.h"
35+
#include "xls/ir/register.h"
3536
#include "xls/ir/source_location.h"
3637
#include "xls/ir/type.h"
3738
#include "xls/ir/value.h"
@@ -335,7 +336,8 @@ TEST(FunctionBuilderTest, MinDelayNegativeWithGetError) {
335336
BValue token = fb.AfterAll({});
336337
fb.MinDelay(token, /*delay=*/-5);
337338

338-
EXPECT_THAT(fb.GetError(),
339+
EXPECT_THAT(
340+
fb.GetError(),
339341
status_testing::StatusIs(absl::StatusCode::kInvalidArgument,
340342
testing::HasSubstr("Delay cannot be negative")));
341343
}
@@ -1006,7 +1008,6 @@ TEST(FunctionBuilderTest, TraceWithVerbosity) {
10061008
EXPECT_EQ(f->return_value()->As<Trace>()->verbosity(), 1);
10071009
}
10081010

1009-
10101011
TEST(FunctionBuilderTest, TraceWrongTypeOperand0) {
10111012
Package p("p");
10121013
FunctionBuilder b("f", &p);

xls/ir/function_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "absl/status/status.h"
2727
#include "xls/common/status/matchers.h"
2828
#include "xls/ir/bits.h"
29+
#include "xls/ir/dfs_visitor.h"
2930
#include "xls/ir/function_builder.h"
3031
#include "xls/ir/ir_test_base.h"
3132
#include "xls/ir/node_util.h"

xls/ir/fuzz_type_domain.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ std::optional<int64_t> TypeProtoSize(const TypeProto& type_proto,
4040
case TypeProto::TUPLE: {
4141
int64_t total_size = 0;
4242
for (const auto& element : type_proto.tuple_elements()) {
43-
std::optional<int64_t> element_size =
44-
TypeProtoSize(element, max_size);
43+
std::optional<int64_t> element_size = TypeProtoSize(element, max_size);
4544
if (!element_size.has_value()) {
4645
return std::nullopt;
4746
}

xls/ir/interval.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Interval Interval::ConvexHull(const Interval& lhs, const Interval& rhs) {
134134
}
135135

136136
std::optional<Interval> Interval::Intersect(const Interval& lhs,
137-
const Interval& rhs) {
137+
const Interval& rhs) {
138138
CHECK_EQ(lhs.BitCount(), rhs.BitCount());
139139
CHECK(!lhs.IsImproper());
140140
CHECK(!rhs.IsImproper());

xls/ir/interval_ops.cc

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "xls/ir/bits_ops.h"
3232
#include "xls/ir/interval.h"
3333
#include "xls/ir/interval_set.h"
34+
#include "xls/ir/lsb_or_msb.h"
3435
#include "xls/ir/node.h"
3536
#include "xls/ir/ternary.h"
3637
#include "xls/passes/ternary_evaluator.h"

xls/ir/ir_parser_test.cc

-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
namespace xls {
4343

44-
4544
using status_testing::StatusIs;
4645
using ::testing::ElementsAre;
4746
using ::testing::Eq;
@@ -1874,7 +1873,6 @@ block my_block(x: bits[32], y: bits[32]) {
18741873
ParsePackageAndCheckDump(input);
18751874
}
18761875

1877-
18781876
TEST(IrParserTest, ParseArrayIndex) {
18791877
const std::string input = R"(
18801878
fn foo(x: bits[32][6]) -> bits[32] {

xls/ir/ir_scanner.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "absl/strings/str_cat.h"
3232
#include "absl/strings/str_format.h"
3333
#include "xls/common/status/status_macros.h"
34+
#include "xls/ir/bits.h"
3435
#include "xls/ir/number_parser.h"
3536

3637
namespace xls {
@@ -184,8 +185,8 @@ class Tokenizer {
184185
int64_t content_start = index();
185186
while (!EndOfString()) {
186187
if (MatchSubstring(quote)) {
187-
std::string_view content = std::string_view(
188-
str_.data() + content_start, index() - content_start);
188+
std::string_view content = std::string_view(str_.data() + content_start,
189+
index() - content_start);
189190
Advance(quote.size());
190191
return content;
191192
}
@@ -225,7 +226,7 @@ class Tokenizer {
225226
// last matching character. min_chars is the minimum number of characters
226227
// which are unconditionally captured.
227228
std::string_view CaptureWhile(std::function<bool(char)> test_f,
228-
int64_t min_chars = 0) {
229+
int64_t min_chars = 0) {
229230
int64_t start = index();
230231
while (!EndOfString() &&
231232
((index() < min_chars + start) || test_f(current()))) {

xls/ir/ir_test_base.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ VerifiedPackage::~VerifiedPackage() {
6060

6161
absl::StatusOr<std::unique_ptr<VerifiedPackage>> IrTestBase::ParsePackage(
6262
std::string_view text) {
63-
XLS_ASSIGN_OR_RETURN(std::unique_ptr<VerifiedPackage> package,
64-
Parser::ParseDerivedPackageNoVerify<VerifiedPackage>(
65-
text, std::nullopt));
63+
XLS_ASSIGN_OR_RETURN(
64+
std::unique_ptr<VerifiedPackage> package,
65+
Parser::ParseDerivedPackageNoVerify<VerifiedPackage>(text, std::nullopt));
6666
XLS_RETURN_IF_ERROR(VerifyPackage(package.get()));
6767
return std::move(package);
6868
}

xls/ir/ir_test_base_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "gtest/gtest-spi.h"
2121
#include "gtest/gtest.h"
2222
#include "xls/common/status/matchers.h"
23+
#include "xls/ir/function_base.h"
2324

2425
namespace xls {
2526
namespace {

0 commit comments

Comments
 (0)