Fixup compilation issues with type manager.

This CL fixes up some issues with the type manager.

TBR=dneto@google.com

Change-Id: I2d05935f26490fd8d20b1b6b1b61692a45e4a0f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17940
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
dan sinclair 2020-03-27 01:50:13 +00:00 committed by dan sinclair
parent 288674904d
commit 136fa11d53
12 changed files with 25 additions and 64 deletions

View File

@ -48,7 +48,6 @@ const spv_target_env kTargetEnv = SPV_ENV_WEBGPU_0;
ParserImpl::ParserImpl(Context* ctx, const std::vector<uint32_t>& spv_binary)
: Reader(ctx),
ctx_(ctx),
spv_binary_(spv_binary),
fail_stream_(&success_, &errors_),
namer_(fail_stream_),
@ -188,7 +187,7 @@ ast::type::Type* ParserImpl::ConvertType(uint32_t type_id) {
auto* ast_elem_ty =
ConvertType(type_mgr_->GetId(rtarr_ty->element_type()));
if (ast_elem_ty != nullptr) {
result = ctx_.type_mgr->Get(
result = ctx_.type_mgr().Get(
std::make_unique<ast::type::ArrayType>(ast_elem_ty));
}
// In the error case, we'll already have emitted a diagnostic.
@ -229,7 +228,7 @@ ast::type::Type* ParserImpl::ConvertType(uint32_t type_id) {
<< num_elem;
return nullptr;
}
result = ctx_.type_mgr->Get(std::make_unique<ast::type::ArrayType>(
result = ctx_.type_mgr().Get(std::make_unique<ast::type::ArrayType>(
ast_elem_ty, static_cast<uint32_t>(num_elem)));
break;
}

View File

@ -122,8 +122,6 @@ class ParserImpl : Reader {
/// Emit entry point AST nodes.
bool EmitEntryPoints();
// The Tint context
Context ctx_;
// The SPIR-V binary we're parsing
std::vector<uint32_t> spv_binary_;

View File

@ -37,9 +37,7 @@ class SpvParserTest : public testing::Test {
void SetUp() { ctx_.Reset(); }
/// Tears down the test helper
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
/// Retrieves the parser from the helper
/// @param input the SPIR-V binary to parse

View File

@ -2093,7 +2093,7 @@ std::unique_ptr<ast::Literal> ParserImpl::const_literal() {
if (t.IsTrue()) {
next(); // Consume the peek
auto type = ctx_.type_mgr->Get(std::make_unique<ast::type::BoolType>());
auto type = ctx_.type_mgr().Get(std::make_unique<ast::type::BoolType>());
if (!type) {
return nullptr;
}
@ -2101,7 +2101,7 @@ std::unique_ptr<ast::Literal> ParserImpl::const_literal() {
}
if (t.IsFalse()) {
next(); // Consume the peek
auto type = ctx_.type_mgr->Get(std::make_unique<ast::type::BoolType>());
auto type = ctx_.type_mgr().Get(std::make_unique<ast::type::BoolType>());
if (!type) {
return nullptr;
}
@ -2109,7 +2109,7 @@ std::unique_ptr<ast::Literal> ParserImpl::const_literal() {
}
if (t.IsIntLiteral()) {
next(); // Consume the peek
auto type = ctx_.type_mgr->Get(std::make_unique<ast::type::I32Type>());
auto type = ctx_.type_mgr().Get(std::make_unique<ast::type::I32Type>());
if (!type) {
return nullptr;
}
@ -2117,7 +2117,7 @@ std::unique_ptr<ast::Literal> ParserImpl::const_literal() {
}
if (t.IsUintLiteral()) {
next(); // Consume the peek
auto type = ctx_.type_mgr->Get(std::make_unique<ast::type::U32Type>());
auto type = ctx_.type_mgr().Get(std::make_unique<ast::type::U32Type>());
if (!type) {
return nullptr;
}
@ -2125,7 +2125,7 @@ std::unique_ptr<ast::Literal> ParserImpl::const_literal() {
}
if (t.IsFloatLiteral()) {
next(); // Consume the peek
auto type = ctx_.type_mgr->Get(std::make_unique<ast::type::F32Type>());
auto type = ctx_.type_mgr().Get(std::make_unique<ast::type::F32Type>());
if (!type) {
return nullptr;
}

View File

@ -38,9 +38,7 @@ class BuiltinTest : public testing::TestWithParam<BuiltinData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -40,9 +40,7 @@ class DerivativeModifierTest
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -38,9 +38,7 @@ class PipelineStageTest : public testing::TestWithParam<PipelineStageData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -38,9 +38,7 @@ class StorageClassTest : public testing::TestWithParam<StorageClassData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -39,9 +39,7 @@ class StructDecorationTest
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -37,9 +37,7 @@ class ParserImplTest : public testing::Test {
void SetUp() { ctx_.Reset(); }
/// Tears down the test helper
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
/// Retrieves the parser from the helper
/// @param str the string to parse

View File

@ -127,9 +127,7 @@ class VecTest : public testing::TestWithParam<VecData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -163,9 +161,7 @@ class VecMissingGreaterThanTest : public testing::TestWithParam<VecData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -198,9 +194,7 @@ class VecMissingLessThanTest : public testing::TestWithParam<VecData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -233,9 +227,7 @@ class VecBadType : public testing::TestWithParam<VecData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -268,9 +260,7 @@ class VecMissingType : public testing::TestWithParam<VecData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -485,9 +475,7 @@ class MatrixTest : public testing::TestWithParam<MatrixData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -529,9 +517,7 @@ class MatrixMissingGreaterThanTest : public testing::TestWithParam<MatrixData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -569,9 +555,7 @@ class MatrixMissingLessThanTest : public testing::TestWithParam<MatrixData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -609,9 +593,7 @@ class MatrixBadType : public testing::TestWithParam<MatrixData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);
@ -649,9 +631,7 @@ class MatrixMissingType : public testing::TestWithParam<MatrixData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);

View File

@ -38,9 +38,7 @@ class VariableStorageTest : public testing::TestWithParam<VariableStorageData> {
void SetUp() { ctx_.Reset(); }
void TearDown() {
impl_ = nullptr;
}
void TearDown() { impl_ = nullptr; }
ParserImpl* parser(const std::string& str) {
impl_ = std::make_unique<ParserImpl>(&ctx_, str);