Remove tint::Source::data_view
It's just a view on another field. It doesn't add anything.
Change-Id: I52c1939c455d48c067c9c31938be87671328d263
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110560
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/source.cc b/src/tint/source.cc
index 5dbed6c..6a10de5 100644
--- a/src/tint/source.cc
+++ b/src/tint/source.cc
@@ -113,13 +113,10 @@
} // namespace
-Source::FileContent::FileContent(const std::string& body)
- : data(body), data_view(data), lines(SplitLines(data_view)) {}
+Source::FileContent::FileContent(const std::string& body) : data(body), lines(SplitLines(data)) {}
Source::FileContent::FileContent(const FileContent& rhs)
- : data(rhs.data),
- data_view(data),
- lines(CopyRelativeStringViews(rhs.lines, rhs.data_view, data_view)) {}
+ : data(rhs.data), lines(CopyRelativeStringViews(rhs.lines, rhs.data, data)) {}
Source::FileContent::~FileContent() = default;
diff --git a/src/tint/source.h b/src/tint/source.h
index 734e693..d7ca7b9 100644
--- a/src/tint/source.h
+++ b/src/tint/source.h
@@ -43,8 +43,6 @@
/// The original un-split file content
const std::string data;
- /// A string_view over #data
- const std::string_view data_view;
/// #data split by lines
const std::vector<std::string_view> lines;
};
diff --git a/src/tint/source_test.cc b/src/tint/source_test.cc
index b1241fb..df14a31 100644
--- a/src/tint/source_test.cc
+++ b/src/tint/source_test.cc
@@ -31,7 +31,6 @@
TEST_F(SourceFileContentTest, Init) {
Source::FileContent fc(kSource);
EXPECT_EQ(fc.data, kSource);
- EXPECT_EQ(fc.data_view, kSource);
ASSERT_EQ(fc.lines.size(), 3u);
EXPECT_EQ(fc.lines[0], "line one");
EXPECT_EQ(fc.lines[1], "line two");
@@ -43,7 +42,6 @@
Source::FileContent fc{*src};
src.reset();
EXPECT_EQ(fc.data, kSource);
- EXPECT_EQ(fc.data_view, kSource);
ASSERT_EQ(fc.lines.size(), 3u);
EXPECT_EQ(fc.lines[0], "line one");
EXPECT_EQ(fc.lines[1], "line two");
@@ -55,7 +53,6 @@
Source::FileContent fc{std::move(*src)};
src.reset();
EXPECT_EQ(fc.data, kSource);
- EXPECT_EQ(fc.data_view, kSource);
ASSERT_EQ(fc.lines.size(), 3u);
EXPECT_EQ(fc.lines[0], "line one");
EXPECT_EQ(fc.lines[1], "line two");