mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
ast: Replace NamedType with TypeDecl
TypeDecls (alias, structure) are not a types - they declare types. ast::TypeName is what's used for a ast::Type. Previously we were trying to automatically convert these to TypeNames in the builder, but having these inherit from ast::Type was extremely error prone. reader/spirv was actually constructing ast::Structs and using them as types, which is invalid. Change-Id: I05773ad6d488626606019015b84217a5a55a8e8a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53802 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
@@ -13,11 +13,13 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/sem/struct.h"
|
||||
#include "src/ast/struct_member.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "src/ast/struct_member.h"
|
||||
#include "src/symbol_table.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::Struct);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::StructMember);
|
||||
|
||||
@@ -51,7 +53,7 @@ std::string Struct::type_name() const {
|
||||
}
|
||||
|
||||
std::string Struct::FriendlyName(const SymbolTable& symbols) const {
|
||||
return declaration_->FriendlyName(symbols);
|
||||
return symbols.NameFor(declaration_->name());
|
||||
}
|
||||
|
||||
StructMember::StructMember(ast::StructMember* declaration,
|
||||
|
||||
@@ -28,6 +28,7 @@ class MemberAccessorExpression;
|
||||
class Statement;
|
||||
class StructMember;
|
||||
class Type;
|
||||
class TypeDecl;
|
||||
class Variable;
|
||||
} // namespace ast
|
||||
|
||||
@@ -57,6 +58,7 @@ struct TypeMappings {
|
||||
Statement* operator()(ast::Statement*);
|
||||
StructMember* operator()(ast::StructMember*);
|
||||
Type* operator()(ast::Type*);
|
||||
Type* operator()(ast::TypeDecl*);
|
||||
Variable* operator()(ast::Variable*);
|
||||
//! @endcond
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user