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>
This commit is contained in:
Ben Clayton 2022-11-17 19:16:24 +00:00 committed by Dawn LUCI CQ
parent 6a4c918cbf
commit e412c8d8c6
3 changed files with 2 additions and 10 deletions

View File

@ -113,13 +113,10 @@ std::vector<std::string_view> CopyRelativeStringViews(const std::vector<std::str
} // 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;

View File

@ -43,8 +43,6 @@ class Source {
/// 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;
};

View File

@ -31,7 +31,6 @@ using SourceFileContentTest = testing::Test;
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 @@ TEST_F(SourceFileContentTest, CopyInit) {
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 @@ TEST_F(SourceFileContentTest, MoveInit) {
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");