mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
ast: Keep style consistent
Methods and functions are `CamelCase()` Public fields are `snake_case` with no trailing `_` Private fields are `snake_case` with a trailing `_` Remove pointless getters on fully immutable fields. They provide no value, and just add `()` noise on use. Remove unused methods. Bug: tint:1231 Change-Id: If32efd039df48938efd5bc2186d51fe4853e9840 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66600 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
b3e6c0d62c
commit
4f3ff57c28
@@ -40,7 +40,7 @@ void BlockStatement::AddDecl(ast::Variable* var) {
|
||||
}
|
||||
|
||||
FunctionBlockStatement::FunctionBlockStatement(const ast::Function* function)
|
||||
: Base(function->body(), nullptr), function_(function) {}
|
||||
: Base(function->body, nullptr), function_(function) {}
|
||||
|
||||
FunctionBlockStatement::~FunctionBlockStatement() = default;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Function::ReferencedLocationVariables() const {
|
||||
std::vector<std::pair<const Variable*, ast::LocationDecoration*>> ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
for (auto* deco : var->Declaration()->decorations()) {
|
||||
for (auto* deco : var->Declaration()->decorations) {
|
||||
if (auto* location = deco->As<ast::LocationDecoration>()) {
|
||||
ret.push_back({var, location});
|
||||
break;
|
||||
@@ -75,7 +75,7 @@ Function::VariableBindings Function::ReferencedUniformVariables() const {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
if (auto binding_point = var->Declaration()->BindingPoint()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ Function::VariableBindings Function::ReferencedStorageBufferVariables() const {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
if (auto binding_point = var->Declaration()->BindingPoint()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ Function::ReferencedBuiltinVariables() const {
|
||||
std::vector<std::pair<const Variable*, ast::BuiltinDecoration*>> ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
for (auto* deco : var->Declaration()->decorations()) {
|
||||
for (auto* deco : var->Declaration()->decorations) {
|
||||
if (auto* builtin = deco->As<ast::BuiltinDecoration>()) {
|
||||
ret.push_back({var, builtin});
|
||||
break;
|
||||
@@ -136,7 +136,7 @@ Function::VariableBindings Function::ReferencedVariablesOfType(
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
auto* unwrapped_type = var->Type()->UnwrapRef();
|
||||
if (unwrapped_type->TypeInfo().Is(type_info)) {
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
if (auto binding_point = var->Declaration()->BindingPoint()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ Function::VariableBindings Function::ReferencedSamplerVariablesImpl(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
if (auto binding_point = var->Declaration()->BindingPoint()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ Function::VariableBindings Function::ReferencedSampledTextureVariablesImpl(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
if (auto binding_point = var->Declaration()->BindingPoint()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ struct WorkgroupDimension {
|
||||
/// Function holds the semantic information for function nodes.
|
||||
class Function : public Castable<Function, CallTarget> {
|
||||
public:
|
||||
/// A vector of [Variable*, ast::Variable::BindingPoint] pairs
|
||||
/// A vector of [Variable*, ast::VariableBindingPoint] pairs
|
||||
using VariableBindings =
|
||||
std::vector<std::pair<const Variable*, ast::Variable::BindingPoint>>;
|
||||
std::vector<std::pair<const Variable*, ast::VariableBindingPoint>>;
|
||||
|
||||
/// Constructor
|
||||
/// @param declaration the ast::Function
|
||||
|
||||
@@ -28,7 +28,7 @@ TEST_F(StructTest, Creation) {
|
||||
create<ast::Struct>(name, ast::StructMemberList{}, ast::DecorationList{});
|
||||
auto* ptr = impl;
|
||||
auto* s =
|
||||
create<sem::Struct>(impl, impl->name(), StructMemberList{}, 4 /* align */,
|
||||
create<sem::Struct>(impl, impl->name, StructMemberList{}, 4 /* align */,
|
||||
8 /* size */, 16 /* size_no_padding */);
|
||||
EXPECT_EQ(s->Declaration(), ptr);
|
||||
EXPECT_EQ(s->Align(), 4u);
|
||||
@@ -41,7 +41,7 @@ TEST_F(StructTest, TypeName) {
|
||||
auto* impl =
|
||||
create<ast::Struct>(name, ast::StructMemberList{}, ast::DecorationList{});
|
||||
auto* s =
|
||||
create<sem::Struct>(impl, impl->name(), StructMemberList{}, 4 /* align */,
|
||||
create<sem::Struct>(impl, impl->name, StructMemberList{}, 4 /* align */,
|
||||
4 /* size */, 4 /* size_no_padding */);
|
||||
EXPECT_EQ(s->type_name(), "__struct_$1");
|
||||
}
|
||||
@@ -51,7 +51,7 @@ TEST_F(StructTest, FriendlyName) {
|
||||
auto* impl =
|
||||
create<ast::Struct>(name, ast::StructMemberList{}, ast::DecorationList{});
|
||||
auto* s =
|
||||
create<sem::Struct>(impl, impl->name(), StructMemberList{}, 4 /* align */,
|
||||
create<sem::Struct>(impl, impl->name, StructMemberList{}, 4 /* align */,
|
||||
4 /* size */, 4 /* size_no_padding */);
|
||||
EXPECT_EQ(s->FriendlyName(Symbols()), "my_struct");
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ Struct::~Struct() = default;
|
||||
|
||||
const StructMember* Struct::FindMember(Symbol name) const {
|
||||
for (auto* member : members_) {
|
||||
if (member->Declaration()->symbol() == name) {
|
||||
if (member->Declaration()->symbol == name) {
|
||||
return member;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user