Remove the context object.

This CL strips the context object out of Tint.

Change-Id: Id0dcb9c557b217c03a8d9ac08fc9fe1c799f3fdc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34742
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
dan sinclair
2020-12-07 16:03:54 +00:00
committed by Commit Bot service account
parent bd018d254d
commit c35176eadf
67 changed files with 18 additions and 223 deletions

View File

@@ -23,9 +23,6 @@ namespace spirv {
Parser::Parser(const std::vector<uint32_t>& spv_binary)
: Reader(), impl_(std::make_unique<ParserImpl>(spv_binary)) {}
Parser::Parser(Context*, const std::vector<uint32_t>& spv_binary)
: Parser(spv_binary) {}
Parser::~Parser() = default;
bool Parser::Parse() {

View File

@@ -19,7 +19,6 @@
#include <memory>
#include <vector>
#include "src/context.h"
#include "src/reader/reader.h"
namespace tint {
@@ -34,11 +33,6 @@ class Parser : public Reader {
/// Creates a new parser
/// @param input the input data to parse
explicit Parser(const std::vector<uint32_t>& input);
/// Creates a new parser
/// DEPRECATED
/// @param ctx the non-null context object
/// @param input the input data to parse
Parser(Context* ctx, const std::vector<uint32_t>& input);
/// Destructor
~Parser() override;

View File

@@ -18,7 +18,6 @@
#include <vector>
#include "gtest/gtest.h"
#include "src/context.h"
namespace tint {
namespace reader {
@@ -29,8 +28,7 @@ using ParserTest = testing::Test;
TEST_F(ParserTest, Uint32VecEmpty) {
std::vector<uint32_t> data;
Context ctx;
Parser p(&ctx, data);
Parser p(data);
EXPECT_FALSE(p.Parse());
// TODO(dneto): What message?
}

View File

@@ -25,8 +25,6 @@ namespace wgsl {
Parser::Parser(Source::File const* file)
: Reader(), impl_(std::make_unique<ParserImpl>(file)) {}
Parser::Parser(Context*, Source::File const* file) : Parser(file) {}
Parser::~Parser() = default;
bool Parser::Parse() {

View File

@@ -18,7 +18,6 @@
#include <memory>
#include <string>
#include "src/context.h"
#include "src/reader/reader.h"
#include "src/source.h"
@@ -34,11 +33,6 @@ class Parser : public Reader {
/// Creates a new parser from the given file.
/// @param file the input source file to parse
explicit Parser(Source::File const* file);
/// Creates a new parser from the given file.
/// DEPRECATED
/// @param ctx the non-null context object
/// @param file the input source file to parse
Parser(Context* ctx, Source::File const* file);
~Parser() override;
/// Run the parser

View File

@@ -21,7 +21,6 @@
#include <vector>
#include "gtest/gtest.h"
#include "src/context.h"
#include "src/reader/wgsl/parser_impl.h"
namespace tint {

View File

@@ -15,7 +15,6 @@
#include "src/reader/wgsl/parser.h"
#include "gtest/gtest.h"
#include "src/context.h"
namespace tint {
namespace reader {
@@ -25,14 +24,12 @@ namespace {
using ParserTest = testing::Test;
TEST_F(ParserTest, Empty) {
Context ctx;
Source::File file("test.wgsl", "");
Parser p(&ctx, &file);
Parser p(&file);
ASSERT_TRUE(p.Parse()) << p.error();
}
TEST_F(ParserTest, Parses) {
Context ctx;
Source::File file("test.wgsl", R"(
[[location(0)]] var<out> gl_FragColor : vec4<f32>;
@@ -41,7 +38,7 @@ fn main() -> void {
gl_FragColor = vec4<f32>(.4, .2, .3, 1);
}
)");
Parser p(&ctx, &file);
Parser p(&file);
ASSERT_TRUE(p.Parse()) << p.error();
auto m = p.module();
@@ -50,12 +47,11 @@ fn main() -> void {
}
TEST_F(ParserTest, HandlesError) {
Context ctx;
Source::File file("test.wgsl", R"(
fn main() -> { # missing return type
return;
})");
Parser p(&ctx, &file);
Parser p(&file);
ASSERT_FALSE(p.Parse());
ASSERT_TRUE(p.has_error());