Update namer to use symbol table.

This Cl updates the various namer objects to work off the symbol table
instead of names.

Change-Id: I94b00a10225d0587f037cfaa6d9b42e2a8885734
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35101
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2020-12-10 18:40:01 +00:00
committed by Commit Bot service account
parent 591268db48
commit 1e0472cdba
5 changed files with 116 additions and 89 deletions

View File

@@ -81,6 +81,10 @@ Symbol Module::RegisterSymbol(const std::string& name) {
return symbol_table_.Register(name);
}
std::string Module::SymbolToName(const Symbol sym) const {
return symbol_table_.NameFor(sym);
}
bool Module::IsValid() const {
for (auto* var : global_variables_) {
if (var == nullptr || !var->IsValid()) {

View File

@@ -169,6 +169,11 @@ class Module {
/// previously generated symbol will be returned.
Symbol RegisterSymbol(const std::string& name);
/// Returns the `name` for `sym`
/// @param sym the symbol to retrieve the name for
/// @returns the use provided `name` for the symbol or "" if not found
std::string SymbolToName(const Symbol sym) const;
private:
Module(const Module&) = delete;