Remove unused files.
Clean up some old unused files.
Change-Id: Ib9d1470ee9e66f914cf112cfa558cdda1032fc15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/216374
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/utils/bytes/BUILD.bazel b/src/tint/utils/bytes/BUILD.bazel
index a7c15f8..9473957 100644
--- a/src/tint/utils/bytes/BUILD.bazel
+++ b/src/tint/utils/bytes/BUILD.bazel
@@ -40,18 +40,14 @@
name = "bytes",
srcs = [
"buffer_reader.cc",
- "bytes.cc",
"reader.cc",
- "writer.cc",
],
hdrs = [
"buffer_reader.h",
- "buffer_writer.h",
"decoder.h",
"endianness.h",
"reader.h",
"swap.h",
- "writer.h",
],
deps = [
"//src/tint/utils/containers",
@@ -75,7 +71,6 @@
alwayslink = True,
srcs = [
"buffer_reader_test.cc",
- "buffer_writer_test.cc",
"decoder_test.cc",
"swap_test.cc",
],
diff --git a/src/tint/utils/bytes/BUILD.cmake b/src/tint/utils/bytes/BUILD.cmake
index d125e13..499e0b2 100644
--- a/src/tint/utils/bytes/BUILD.cmake
+++ b/src/tint/utils/bytes/BUILD.cmake
@@ -41,15 +41,11 @@
tint_add_target(tint_utils_bytes lib
utils/bytes/buffer_reader.cc
utils/bytes/buffer_reader.h
- utils/bytes/buffer_writer.h
- utils/bytes/bytes.cc
utils/bytes/decoder.h
utils/bytes/endianness.h
utils/bytes/reader.cc
utils/bytes/reader.h
utils/bytes/swap.h
- utils/bytes/writer.cc
- utils/bytes/writer.h
)
tint_target_add_dependencies(tint_utils_bytes lib
@@ -76,7 +72,6 @@
################################################################################
tint_add_target(tint_utils_bytes_test test
utils/bytes/buffer_reader_test.cc
- utils/bytes/buffer_writer_test.cc
utils/bytes/decoder_test.cc
utils/bytes/swap_test.cc
)
diff --git a/src/tint/utils/bytes/BUILD.gn b/src/tint/utils/bytes/BUILD.gn
index 208fd8e..7685135 100644
--- a/src/tint/utils/bytes/BUILD.gn
+++ b/src/tint/utils/bytes/BUILD.gn
@@ -47,15 +47,11 @@
sources = [
"buffer_reader.cc",
"buffer_reader.h",
- "buffer_writer.h",
- "bytes.cc",
"decoder.h",
"endianness.h",
"reader.cc",
"reader.h",
"swap.h",
- "writer.cc",
- "writer.h",
]
deps = [
"${dawn_root}/src/utils:utils",
@@ -76,7 +72,6 @@
tint_unittests_source_set("unittests") {
sources = [
"buffer_reader_test.cc",
- "buffer_writer_test.cc",
"decoder_test.cc",
"swap_test.cc",
]
diff --git a/src/tint/utils/bytes/buffer_writer.h b/src/tint/utils/bytes/buffer_writer.h
deleted file mode 100644
index 8ba37dc..0000000
--- a/src/tint/utils/bytes/buffer_writer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2024 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef SRC_TINT_UTILS_BYTES_BUFFER_WRITER_H_
-#define SRC_TINT_UTILS_BYTES_BUFFER_WRITER_H_
-
-#include <stdint.h>
-
-#include "src/tint/utils/bytes/writer.h"
-
-namespace tint::bytes {
-
-/// BufferWriter is an implementation of the Writer interface backed by a buffer.
-template <size_t N>
-class BufferWriter final : public Writer {
- public:
- /// @copydoc Writer::Write
- Result<SuccessType> Write(const std::byte* in, size_t count) override {
- size_t at = buffer.Length();
- buffer.Resize(at + count);
- memcpy(&buffer[at], in, count);
- return Success;
- }
-
- /// @returns the buffer content as a string view
- std::string_view BufferString() const {
- if (buffer.IsEmpty()) {
- return "";
- }
- auto* data = reinterpret_cast<const char*>(&buffer[0]);
- static_assert(sizeof(std::byte) == sizeof(char), "length needs calculation");
- return std::string_view(data, buffer.Length());
- }
-
- /// The buffer holding the written data
- Vector<std::byte, N> buffer;
-};
-
-/// Deduction guide for BufferWriter
-BufferWriter() -> BufferWriter<32>;
-
-} // namespace tint::bytes
-
-#endif // SRC_TINT_UTILS_BYTES_BUFFER_WRITER_H_
diff --git a/src/tint/utils/bytes/buffer_writer_test.cc b/src/tint/utils/bytes/buffer_writer_test.cc
deleted file mode 100644
index 7d386ca..0000000
--- a/src/tint/utils/bytes/buffer_writer_test.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2024 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "src/tint/utils/bytes/buffer_writer.h"
-
-#include "gmock/gmock.h"
-#include "src/tint/utils/containers/transform.h"
-
-namespace tint::bytes {
-namespace {
-
-template <typename T, typename U, size_t N>
-Vector<T, N> Cast(const Vector<U, N>& in) {
- return Transform(in, [](auto el) { return static_cast<T>(el); });
-}
-
-TEST(BufferWriterTest, IntegerBigEndian) {
- BufferWriter<16> writer;
- EXPECT_EQ(writer.Int(0x10203040u, Endianness::kBig), Success);
- EXPECT_THAT(Cast<int>(writer.buffer), testing::ElementsAre(0x10, 0x20, 0x30, 0x40));
-}
-
-TEST(BufferWriterTest, IntegerLittleEndian) {
- BufferWriter<16> writer;
- EXPECT_EQ(writer.Int(0x10203040u, Endianness::kLittle), Success);
- EXPECT_THAT(Cast<int>(writer.buffer), testing::ElementsAre(0x40, 0x30, 0x20, 0x10));
-}
-
-TEST(BufferWriterTest, Float) {
- BufferWriter<16> writer;
- EXPECT_EQ(writer.Float<float>(8.5f), Success);
- EXPECT_THAT(Cast<int>(writer.buffer), testing::ElementsAre(0x00, 0x00, 0x08, 0x41));
-}
-
-TEST(BufferWriterTest, Bool) {
- BufferWriter<16> writer;
- EXPECT_EQ(writer.Bool(true), Success);
- EXPECT_THAT(Cast<int>(writer.buffer), testing::ElementsAre(0x01));
-}
-
-} // namespace
-} // namespace tint::bytes
diff --git a/src/tint/utils/bytes/bytes.cc b/src/tint/utils/bytes/bytes.cc
deleted file mode 100644
index 392f0ea..0000000
--- a/src/tint/utils/bytes/bytes.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2023 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#if defined(__clang__)
-#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
-#endif
-
-// A placeholder symbol used to emit a symbol for this lib target.
-int tint_utils_bytes_symbol = 1;
diff --git a/src/tint/utils/bytes/writer.cc b/src/tint/utils/bytes/writer.cc
deleted file mode 100644
index 005c5fc..0000000
--- a/src/tint/utils/bytes/writer.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2024 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "src/tint/utils/bytes/writer.h"
-
-namespace tint::bytes {
-
-Writer::~Writer() = default;
-
-}
diff --git a/src/tint/utils/bytes/writer.h b/src/tint/utils/bytes/writer.h
deleted file mode 100644
index 3f9ce97..0000000
--- a/src/tint/utils/bytes/writer.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2024 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef SRC_TINT_UTILS_BYTES_WRITER_H_
-#define SRC_TINT_UTILS_BYTES_WRITER_H_
-
-#include <algorithm>
-#include <cstdint>
-#include <string>
-
-#include "src/tint/utils/bytes/endianness.h"
-#include "src/tint/utils/bytes/swap.h"
-#include "src/tint/utils/containers/slice.h"
-#include "src/tint/utils/result/result.h"
-
-namespace tint::bytes {
-
-/// A binary stream writer interface
-class Writer {
- public:
- /// Destructor
- virtual ~Writer();
-
- /// Write writes bytes to the stream, blocking until the write has finished.
- /// @param in the byte data to write to the stream
- /// @param count the number of bytes to write. Must be greater than 0
- /// @returns the result of the write
- virtual Result<SuccessType> Write(const std::byte* in, size_t count) = 0;
-
- /// Writes an integer to the stream, performing byte swapping if the stream's endianness
- /// differs from the native endianness.
- /// @param value the integer value to write
- /// @param endianness the endianness of the integer in the stream
- /// @returns the result of the write
- template <typename T>
- Result<SuccessType> Int(T value, Endianness endianness = Endianness::kLittle) {
- static_assert(std::is_integral_v<T>);
- if (NativeEndianness() != endianness) {
- value = Swap(value);
- }
- return Write(reinterpret_cast<const std::byte*>(&value), sizeof(T));
- }
-
- /// Writes a float to the stream.
- /// @param value the float value to write
- /// @returns the result of the write
- template <typename T>
- Result<SuccessType> Float(T value) {
- static_assert(std::is_floating_point_v<T>);
- return Write(reinterpret_cast<const std::byte*>(&value), sizeof(T));
- }
-
- /// Writes a boolean to the stream
- /// @param value the boolean value to write
- /// @returns the result of the write
- Result<SuccessType> Bool(bool value) {
- auto b = value ? std::byte{1} : std::byte{0};
- return Write(&b, 1);
- }
-
- /// Writes a string of @p len bytes to the stream.
- /// @param value the string to write
- /// @returns the result of the write
- Result<SuccessType> String(std::string_view value) {
- static_assert(sizeof(std::byte) == sizeof(char), "length needs calculation");
- return Write(reinterpret_cast<const std::byte*>(value.data()), value.length());
- }
-};
-
-} // namespace tint::bytes
-
-#endif // SRC_TINT_UTILS_BYTES_WRITER_H_