Place the namer into the context object.

This CL moves the namer into the context object and makes it a parameter
to the various generators. The old constructor is maintained until we've
updated downstream repos.

Bug: tint:273
Change-Id: I49b2519c4250be21fb73374b16e7c702b727078f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32580
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair
2020-11-13 18:13:24 +00:00
committed by Commit Bot service account
parent 8ca4561b25
commit 196e097730
144 changed files with 1636 additions and 2730 deletions

View File

@@ -36,14 +36,22 @@
#include "src/ast/type/type.h"
#include "src/ast/type/vector_type.h"
#include "src/ast/uint_literal.h"
#include "src/namer.h"
namespace tint {
namespace inspector {
Inspector::Inspector(const ast::Module& module) : module_(module) {}
Inspector::Inspector(const ast::Module& module)
: ctx_(new Context()), context_is_owned_(true), module_(module) {}
Inspector::~Inspector() = default;
Inspector::Inspector(Context* ctx, const ast::Module& module)
: ctx_(ctx), context_is_owned_(false), module_(module) {
assert(ctx);
}
Inspector::~Inspector() {
if (context_is_owned_)
delete ctx_;
}
std::vector<EntryPoint> Inspector::GetEntryPoints() {
std::vector<EntryPoint> result;
@@ -55,7 +63,7 @@ std::vector<EntryPoint> Inspector::GetEntryPoints() {
EntryPoint entry_point;
entry_point.name = func->name();
entry_point.remapped_name = namer_.NameFor(func->name());
entry_point.remapped_name = ctx_->namer()->NameFor(func->name());
entry_point.stage = func->pipeline_stage();
std::tie(entry_point.workgroup_size_x, entry_point.workgroup_size_y,
entry_point.workgroup_size_z) = func->workgroup_size();
@@ -82,7 +90,7 @@ std::string Inspector::GetRemappedNameForEntryPoint(
// if (!func) {
// return {};
// }
// return namer_.NameFor(entry_point);
// return ctx_->namer()->NameFor(entry_point);
return entry_point;
}