tint/ast: Clean up StorageClass enum

Remove unused enum entries.
Add a ParseStorageClass() function. Have the WGSL parser use this.

First step to standardizing the way we parse enum-backed token sets.

Change-Id: I31c02816493beeabda740ff43946edce097f5fd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97148
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2022-07-26 22:51:36 +00:00
committed by Dawn LUCI CQ
parent ce8876074f
commit 48085845bd
24 changed files with 150 additions and 132 deletions

View File

@@ -49,6 +49,7 @@
#include "src/tint/sem/vector.h"
#include "src/tint/sem/void.h"
#include "src/tint/utils/math.h"
#include "src/tint/utils/string.h"
#include "src/tint/utils/unique_vector.h"
namespace tint::inspector {
@@ -570,7 +571,7 @@ std::vector<std::string> Inspector::GetUsedExtensionNames() {
std::vector<std::string> out;
out.reserve(extensions.size());
for (auto ext : extensions) {
out.push_back(ast::str(ext));
out.push_back(utils::ToString(ext));
}
return out;
}
@@ -582,7 +583,7 @@ std::vector<std::pair<std::string, Source>> Inspector::GetEnableDirectives() {
auto global_decls = program_->AST().GlobalDeclarations();
for (auto* node : global_decls) {
if (auto* ext = node->As<ast::Enable>()) {
result.push_back({ast::str(ext->extension), ext->source});
result.push_back({utils::ToString(ext->extension), ext->source});
}
}