mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Remove suppressing [chromium-style] errors
Lots of little style nits needed to be fixed for this work. BUG=tint:44 Change-Id: Ibb45d9e3f6795ee0c09f5eca994bb28e20979d97 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19221 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
committed by
dan sinclair
parent
1234633b32
commit
4d32be4f1b
@@ -27,6 +27,14 @@ AliasType::AliasType(const std::string& name, Type* subtype)
|
||||
|
||||
AliasType::~AliasType() = default;
|
||||
|
||||
bool AliasType::IsAlias() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AliasType::type_name() const {
|
||||
return "__alias_" + name_ + subtype_->type_name();
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -35,7 +35,7 @@ class AliasType : public Type {
|
||||
~AliasType() override;
|
||||
|
||||
/// @returns true if the type is an alias type
|
||||
bool IsAlias() const override { return true; }
|
||||
bool IsAlias() const override;
|
||||
|
||||
/// @returns the alias name
|
||||
const std::string& name() const { return name_; }
|
||||
@@ -43,9 +43,7 @@ class AliasType : public Type {
|
||||
Type* type() const { return subtype_; }
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override {
|
||||
return "__alias_" + name_ + subtype_->type_name();
|
||||
}
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
|
||||
@@ -23,8 +23,24 @@ ArrayType::ArrayType(Type* subtype) : subtype_(subtype) {}
|
||||
ArrayType::ArrayType(Type* subtype, uint32_t size)
|
||||
: subtype_(subtype), size_(size) {}
|
||||
|
||||
ArrayType::ArrayType(ArrayType&&) = default;
|
||||
|
||||
ArrayType::~ArrayType() = default;
|
||||
|
||||
bool ArrayType::IsArray() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ArrayType::type_name() const {
|
||||
assert(subtype_);
|
||||
|
||||
std::string type_name = "__array" + subtype_->type_name();
|
||||
if (!IsRuntimeArray())
|
||||
type_name += "_" + std::to_string(size_);
|
||||
|
||||
return type_name;
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -36,11 +36,11 @@ class ArrayType : public Type {
|
||||
/// @param size the number of elements in the array
|
||||
ArrayType(Type* subtype, uint32_t size);
|
||||
/// Move constructor
|
||||
ArrayType(ArrayType&&) = default;
|
||||
ArrayType(ArrayType&&);
|
||||
~ArrayType() override;
|
||||
|
||||
/// @returns true if the type is an array type
|
||||
bool IsArray() const override { return true; }
|
||||
bool IsArray() const override;
|
||||
/// @returns true if this is a runtime array.
|
||||
/// i.e. the size is determined at runtime
|
||||
bool IsRuntimeArray() const { return size_ == 0; }
|
||||
@@ -51,15 +51,7 @@ class ArrayType : public Type {
|
||||
uint32_t size() const { return size_; }
|
||||
|
||||
/// @returns the name for the type
|
||||
std::string type_name() const override {
|
||||
assert(subtype_);
|
||||
|
||||
std::string type_name = "__array" + subtype_->type_name();
|
||||
if (!IsRuntimeArray())
|
||||
type_name += "_" + std::to_string(size_);
|
||||
|
||||
return type_name;
|
||||
}
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
Type* subtype_ = nullptr;
|
||||
|
||||
@@ -22,6 +22,14 @@ BoolType::BoolType() = default;
|
||||
|
||||
BoolType::~BoolType() = default;
|
||||
|
||||
bool BoolType::IsBool() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string BoolType::type_name() const {
|
||||
return "__bool";
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -33,10 +33,10 @@ class BoolType : public Type {
|
||||
~BoolType() override;
|
||||
|
||||
/// @returns true if the type is a bool type
|
||||
bool IsBool() const override { return true; }
|
||||
bool IsBool() const override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override { return "__bool"; }
|
||||
std::string type_name() const override;
|
||||
};
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -22,6 +22,14 @@ F32Type::F32Type() = default;
|
||||
|
||||
F32Type::~F32Type() = default;
|
||||
|
||||
bool F32Type::IsF32() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string F32Type::type_name() const {
|
||||
return "__f32";
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -33,10 +33,10 @@ class F32Type : public Type {
|
||||
~F32Type() override;
|
||||
|
||||
/// @returns true if the type is an f32 type
|
||||
bool IsF32() const override { return true; }
|
||||
bool IsF32() const override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override { return "__f32"; }
|
||||
std::string type_name() const override;
|
||||
};
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -22,6 +22,14 @@ I32Type::I32Type() = default;
|
||||
|
||||
I32Type::~I32Type() = default;
|
||||
|
||||
bool I32Type::IsI32() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string I32Type::type_name() const {
|
||||
return "__i32";
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -33,10 +33,10 @@ class I32Type : public Type {
|
||||
~I32Type() override;
|
||||
|
||||
/// @returns true if the type is an i32 type
|
||||
bool IsI32() const override { return true; }
|
||||
bool IsI32() const override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override { return "__i32"; }
|
||||
std::string type_name() const override;
|
||||
};
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -28,6 +28,15 @@ MatrixType::MatrixType(Type* subtype, uint32_t rows, uint32_t columns)
|
||||
assert(columns < 5);
|
||||
}
|
||||
|
||||
bool MatrixType::IsMatrix() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MatrixType::type_name() const {
|
||||
return "__mat_" + std::to_string(rows_) + "_" + std::to_string(columns_) +
|
||||
subtype_->type_name();
|
||||
}
|
||||
|
||||
MatrixType::~MatrixType() = default;
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -36,7 +36,7 @@ class MatrixType : public Type {
|
||||
~MatrixType() override;
|
||||
|
||||
/// @returns true if the type is a matrix type
|
||||
bool IsMatrix() const override { return true; }
|
||||
bool IsMatrix() const override;
|
||||
|
||||
/// @returns the type of the matrix
|
||||
Type* type() const { return subtype_; }
|
||||
@@ -46,10 +46,7 @@ class MatrixType : public Type {
|
||||
uint32_t columns() const { return columns_; }
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override {
|
||||
return "__mat_" + std::to_string(rows_) + "_" + std::to_string(columns_) +
|
||||
subtype_->type_name();
|
||||
}
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
Type* subtype_ = nullptr;
|
||||
|
||||
@@ -21,6 +21,16 @@ namespace type {
|
||||
PointerType::PointerType(Type* subtype, StorageClass storage_class)
|
||||
: subtype_(subtype), storage_class_(storage_class) {}
|
||||
|
||||
bool PointerType::IsPointer() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string PointerType::type_name() const {
|
||||
std::ostringstream out;
|
||||
out << "__ptr_" << storage_class_ << subtype_->type_name();
|
||||
return out.str();
|
||||
}
|
||||
|
||||
PointerType::~PointerType() = default;
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -37,7 +37,7 @@ class PointerType : public Type {
|
||||
~PointerType() override;
|
||||
|
||||
/// @returns true if the type is a pointer type
|
||||
bool IsPointer() const override { return true; }
|
||||
bool IsPointer() const override;
|
||||
|
||||
/// @returns the pointee type
|
||||
Type* type() const { return subtype_; }
|
||||
@@ -45,11 +45,7 @@ class PointerType : public Type {
|
||||
StorageClass storage_class() const { return storage_class_; }
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override {
|
||||
std::ostringstream out;
|
||||
out << "__ptr_" << storage_class_ << subtype_->type_name();
|
||||
return out.str();
|
||||
}
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
Type* subtype_;
|
||||
|
||||
@@ -23,6 +23,16 @@ namespace type {
|
||||
StructType::StructType(std::unique_ptr<Struct> impl)
|
||||
: struct_(std::move(impl)) {}
|
||||
|
||||
StructType::StructType(StructType&&) = default;
|
||||
|
||||
bool StructType::IsStruct() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string StructType::type_name() const {
|
||||
return "__struct_" + name_;
|
||||
}
|
||||
|
||||
StructType::~StructType() = default;
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -32,7 +32,7 @@ class StructType : public Type {
|
||||
/// @param impl the struct data
|
||||
explicit StructType(std::unique_ptr<Struct> impl);
|
||||
/// Move constructor
|
||||
StructType(StructType&&) = default;
|
||||
StructType(StructType&&);
|
||||
~StructType() override;
|
||||
|
||||
/// Sets the name of the struct
|
||||
@@ -42,13 +42,13 @@ class StructType : public Type {
|
||||
const std::string& name() const { return name_; }
|
||||
|
||||
/// @returns true if the type is a struct type
|
||||
bool IsStruct() const override { return true; }
|
||||
bool IsStruct() const override;
|
||||
|
||||
/// @returns the struct name
|
||||
Struct* impl() const { return struct_.get(); }
|
||||
|
||||
/// @returns the name for th type
|
||||
std::string type_name() const override { return "__struct_" + name_; }
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
|
||||
@@ -36,6 +36,50 @@ Type::Type() = default;
|
||||
|
||||
Type::~Type() = default;
|
||||
|
||||
bool Type::IsAlias() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsArray() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsBool() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsF32() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsI32() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsMatrix() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsPointer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsStruct() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsU32() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsVector() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::IsVoid() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
AliasType* Type::AsAlias() {
|
||||
assert(IsAlias());
|
||||
return static_cast<AliasType*>(this);
|
||||
|
||||
@@ -41,27 +41,27 @@ class Type {
|
||||
virtual ~Type();
|
||||
|
||||
/// @returns true if the type is an alias type
|
||||
virtual bool IsAlias() const { return false; }
|
||||
virtual bool IsAlias() const;
|
||||
/// @returns true if the type is an array type
|
||||
virtual bool IsArray() const { return false; }
|
||||
virtual bool IsArray() const;
|
||||
/// @returns true if the type is a bool type
|
||||
virtual bool IsBool() const { return false; }
|
||||
virtual bool IsBool() const;
|
||||
/// @returns true if the type is an f32 type
|
||||
virtual bool IsF32() const { return false; }
|
||||
virtual bool IsF32() const;
|
||||
/// @returns true if the type is an i32 type
|
||||
virtual bool IsI32() const { return false; }
|
||||
virtual bool IsI32() const;
|
||||
/// @returns true if the type is a matrix type
|
||||
virtual bool IsMatrix() const { return false; }
|
||||
virtual bool IsMatrix() const;
|
||||
/// @returns true if the type is a ptr type
|
||||
virtual bool IsPointer() const { return false; }
|
||||
virtual bool IsPointer() const;
|
||||
/// @returns true if the type is a struct type
|
||||
virtual bool IsStruct() const { return false; }
|
||||
virtual bool IsStruct() const;
|
||||
/// @returns true if the type is a u32 type
|
||||
virtual bool IsU32() const { return false; }
|
||||
virtual bool IsU32() const;
|
||||
/// @returns true if the type is a vec type
|
||||
virtual bool IsVector() const { return false; }
|
||||
virtual bool IsVector() const;
|
||||
/// @returns true if the type is a void type
|
||||
virtual bool IsVoid() const { return false; }
|
||||
virtual bool IsVoid() const;
|
||||
|
||||
/// @returns the name for this type. The |type_name| is unique over all types.
|
||||
virtual std::string type_name() const = 0;
|
||||
|
||||
@@ -22,6 +22,16 @@ U32Type::U32Type() = default;
|
||||
|
||||
U32Type::~U32Type() = default;
|
||||
|
||||
U32Type::U32Type(U32Type&&) = default;
|
||||
|
||||
bool U32Type::IsU32() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string U32Type::type_name() const {
|
||||
return "__u32";
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -29,14 +29,14 @@ class U32Type : public Type {
|
||||
/// Constructor
|
||||
U32Type();
|
||||
/// Move constructor
|
||||
U32Type(U32Type&&) = default;
|
||||
U32Type(U32Type&&);
|
||||
~U32Type() override;
|
||||
|
||||
/// @returns true if the type is a u32 type
|
||||
bool IsU32() const override { return true; }
|
||||
bool IsU32() const override;
|
||||
|
||||
/// @returns the name for th type
|
||||
std::string type_name() const override { return "__u32"; }
|
||||
std::string type_name() const override;
|
||||
};
|
||||
|
||||
} // namespace type
|
||||
|
||||
@@ -26,8 +26,18 @@ VectorType::VectorType(Type* subtype, uint32_t size)
|
||||
assert(size_ < 5);
|
||||
}
|
||||
|
||||
VectorType::VectorType(VectorType&&) = default;
|
||||
|
||||
VectorType::~VectorType() = default;
|
||||
|
||||
bool VectorType::IsVector() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string VectorType::type_name() const {
|
||||
return "__vec_" + std::to_string(size_) + subtype_->type_name();
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -31,11 +31,11 @@ class VectorType : public Type {
|
||||
/// @param size the number of elements in the vector
|
||||
VectorType(Type* subtype, uint32_t size);
|
||||
/// Move constructor
|
||||
VectorType(VectorType&&) = default;
|
||||
VectorType(VectorType&&);
|
||||
~VectorType() override;
|
||||
|
||||
/// @returns true if the type is a vector type
|
||||
bool IsVector() const override { return true; }
|
||||
bool IsVector() const override;
|
||||
|
||||
/// @returns the type of the vector elements
|
||||
Type* type() const { return subtype_; }
|
||||
@@ -43,9 +43,7 @@ class VectorType : public Type {
|
||||
uint32_t size() const { return size_; }
|
||||
|
||||
/// @returns the name for th type
|
||||
std::string type_name() const override {
|
||||
return "__vec_" + std::to_string(size_) + subtype_->type_name();
|
||||
}
|
||||
std::string type_name() const override;
|
||||
|
||||
private:
|
||||
Type* subtype_ = nullptr;
|
||||
|
||||
@@ -20,8 +20,18 @@ namespace type {
|
||||
|
||||
VoidType::VoidType() = default;
|
||||
|
||||
VoidType::VoidType(VoidType&&) = default;
|
||||
|
||||
VoidType::~VoidType() = default;
|
||||
|
||||
bool VoidType::IsVoid() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string VoidType::type_name() const {
|
||||
return "__void";
|
||||
}
|
||||
|
||||
} // namespace type
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
@@ -29,14 +29,14 @@ class VoidType : public Type {
|
||||
/// Constructor
|
||||
VoidType();
|
||||
/// Move constructor
|
||||
VoidType(VoidType&&) = default;
|
||||
VoidType(VoidType&&);
|
||||
~VoidType() override;
|
||||
|
||||
/// @returns true if the type is a void type
|
||||
bool IsVoid() const override { return true; }
|
||||
bool IsVoid() const override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override { return "__void"; }
|
||||
std::string type_name() const override;
|
||||
};
|
||||
|
||||
} // namespace type
|
||||
|
||||
Reference in New Issue
Block a user