ast: Have all decorations derive from base class

This is the first step in unifying the way decorations are parsed - i.e. instead of parsing decorations in different ways based on the predicted grammar that follows, we can parse decorations blocks in a unified way, then later verify what we have is as expected.

`StructDecoration` has been transformed from an `enum class` to a proper class so it can derive from `Decoration`.

Bug: tint:282
Bug: tint:291
Change-Id: Iaf12d266068d03edf695acdf2cd21e6cc3ea8eb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31663
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2020-11-03 21:40:20 +00:00
committed by Commit Bot service account
parent 4735f01193
commit 35298800a6
34 changed files with 386 additions and 88 deletions

View File

@@ -25,6 +25,7 @@
#include "src/ast/scalar_constructor_expression.h"
#include "src/ast/stride_decoration.h"
#include "src/ast/struct.h"
#include "src/ast/struct_block_decoration.h"
#include "src/ast/struct_decoration.h"
#include "src/ast/struct_member.h"
#include "src/ast/struct_member_offset_decoration.h"
@@ -234,7 +235,7 @@ void VertexPullingTransform::AddVertexStorageBuffers() {
kStructBufferName, internal_array_type, std::move(member_dec)));
ast::StructDecorationList decos;
decos.push_back(ast::StructDecoration::kBlock);
decos.push_back(std::make_unique<ast::StructBlockDecoration>());
auto* struct_type =
ctx_->type_mgr().Get(std::make_unique<ast::type::StructType>(