[tint] Remove src/tint/reader
It has no value.
Bug: tint:1988
Change-Id: I34932dc6ecc018ceddb24945c50da82fa6b1e76d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/142321
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index f29f5b8..43fbb4c 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -928,15 +928,6 @@
]
}
-libtint_source_set("libtint_reader_src") {
- sources = [
- "reader/reader.cc",
- "reader/reader.h",
- ]
-
- public_deps = [ ":libtint_program_src" ]
-}
-
libtint_source_set("libtint_spv_reader_src") {
sources = [
"lang/spirv/reader/attributes.h",
@@ -967,7 +958,6 @@
":libtint_ast_transform_src",
":libtint_builtins_src",
":libtint_program_src",
- ":libtint_reader_src",
":libtint_sem_src",
":libtint_symbols_src",
":libtint_type_src",
@@ -1094,7 +1084,6 @@
":libtint_ast_src",
":libtint_builtins_src",
":libtint_program_src",
- ":libtint_reader_src",
":libtint_symbols_src",
":libtint_type_src",
":libtint_utils_src",
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index 4b94ea5..2b5b4b8 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -509,8 +509,6 @@
lang/wgsl/sem/variable.cc
lang/wgsl/sem/while_statement.cc
lang/wgsl/sem/while_statement.h
- reader/reader.cc
- reader/reader.h
lang/wgsl/resolver/const_eval.cc
lang/wgsl/resolver/const_eval.h
lang/wgsl/resolver/dependency_graph.cc
diff --git a/src/tint/lang/spirv/reader/parser_impl.cc b/src/tint/lang/spirv/reader/parser_impl.cc
index 0c3ee14..10c1c2b 100644
--- a/src/tint/lang/spirv/reader/parser_impl.cc
+++ b/src/tint/lang/spirv/reader/parser_impl.cc
@@ -277,8 +277,7 @@
: type(type_in), expr(expr_in) {}
ParserImpl::ParserImpl(const std::vector<uint32_t>& spv_binary)
- : Reader(),
- spv_binary_(spv_binary),
+ : spv_binary_(spv_binary),
fail_stream_(&success_, &errors_),
namer_(fail_stream_),
enum_converter_(fail_stream_),
@@ -331,7 +330,7 @@
return success_;
}
-Program ParserImpl::program() {
+Program ParserImpl::Program() {
// TODO(dneto): Should we clear out spv_binary_ here, to reduce
// memory usage?
return tint::Program(std::move(builder_));
diff --git a/src/tint/lang/spirv/reader/parser_impl.h b/src/tint/lang/spirv/reader/parser_impl.h
index 9f4e111..00e0480 100644
--- a/src/tint/lang/spirv/reader/parser_impl.h
+++ b/src/tint/lang/spirv/reader/parser_impl.h
@@ -43,7 +43,6 @@
#include "src/tint/lang/spirv/reader/parser_type.h"
#include "src/tint/lang/spirv/reader/usage.h"
#include "src/tint/lang/wgsl/program/program_builder.h"
-#include "src/tint/reader/reader.h"
/// This is the implementation of the SPIR-V parser for Tint.
@@ -123,23 +122,24 @@
};
/// Parser implementation for SPIR-V.
-class ParserImpl : Reader {
+class ParserImpl {
using ExpressionList = utils::Vector<const ast::Expression*, 8>;
public:
/// Creates a new parser
/// @param input the input data to parse
explicit ParserImpl(const std::vector<uint32_t>& input);
+
/// Destructor
- ~ParserImpl() override;
+ ~ParserImpl();
/// Run the parser
/// @returns true if the parse was successful, false otherwise.
- bool Parse() override;
+ bool Parse();
/// @returns the program. The program builder in the parser will be reset
/// after this.
- Program program() override;
+ tint::Program Program();
/// @returns a reference to the internal builder, without building the
/// program. To be used only for testing.
diff --git a/src/tint/lang/spirv/reader/parser_impl_barrier_test.cc b/src/tint/lang/spirv/reader/parser_impl_barrier_test.cc
index 1e37718..f71e4d6 100644
--- a/src/tint/lang/spirv/reader/parser_impl_barrier_test.cc
+++ b/src/tint/lang/spirv/reader/parser_impl_barrier_test.cc
@@ -41,7 +41,7 @@
builder.Diagnostics().add_error(diag::System::Reader, p->error());
return Program(std::move(builder));
}
- return p->program();
+ return p->Program();
}
TEST_F(SpvParserTest, WorkgroupBarrier) {
diff --git a/src/tint/lang/spirv/reader/parser_impl_test_helper.h b/src/tint/lang/spirv/reader/parser_impl_test_helper.h
index a7968f7..027cb64 100644
--- a/src/tint/lang/spirv/reader/parser_impl_test_helper.h
+++ b/src/tint/lang/spirv/reader/parser_impl_test_helper.h
@@ -77,7 +77,7 @@
/// @returns the program. The program builder in the parser will be reset
/// after this.
- Program program() { return impl_.program(); }
+ Program program() { return impl_.Program(); }
/// @returns the namer object
Namer& namer() { return impl_.namer(); }
diff --git a/src/tint/reader/reader.cc b/src/tint/reader/reader.cc
deleted file mode 100644
index 7eedf28..0000000
--- a/src/tint/reader/reader.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/tint/reader/reader.h"
-
-namespace tint::reader {
-
-Reader::Reader() = default;
-
-Reader::~Reader() = default;
-
-} // namespace tint::reader
diff --git a/src/tint/reader/reader.h b/src/tint/reader/reader.h
deleted file mode 100644
index b9cdc87..0000000
--- a/src/tint/reader/reader.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef SRC_TINT_READER_READER_H_
-#define SRC_TINT_READER_READER_H_
-
-#include <string>
-
-#include "src/tint/lang/wgsl/program/program.h"
-
-namespace tint::reader {
-
-/// Base class for input readers
-class Reader {
- public:
- virtual ~Reader();
-
- /// Parses the input data
- /// @returns true if the parse was successful
- virtual bool Parse() = 0;
-
- /// @returns true if an error was encountered.
- bool has_error() const { return diags_.contains_errors(); }
-
- /// @returns the parser error string
- std::string error() const {
- diag::Formatter formatter{{false, false, false, false}};
- return formatter.format(diags_);
- }
-
- /// @returns the full list of diagnostic messages.
- const diag::List& diagnostics() const { return diags_; }
-
- /// @returns the program. The program builder in the parser will be reset
- /// after this.
- virtual Program program() = 0;
-
- protected:
- /// Constructor
- Reader();
-
- /// Sets the diagnostic messages
- /// @param diags the list of diagnostic messages
- void set_diagnostics(const diag::List& diags) { diags_ = diags; }
-
- /// All diagnostic messages from the reader.
- diag::List diags_;
-};
-
-} // namespace tint::reader
-
-#endif // SRC_TINT_READER_READER_H_