-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WGSL] Unify AST node type traits #6123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WGSL] Unify AST node type traits #6123
Conversation
|
EWS run on current version of this PR (hash 6fbed13) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is a silly question, but should we enable RTTI instead of using all these virtual calls?
I don't know. Is linking code compiled with RTTI against code compiled without RTTI allowed? The typical reason for not using RTTI is that it's not opt-in on a per-class-hierarchy option, so all classes get RTTI information and that data bloats the executable. |
https://bugs.webkit.org/show_bug.cgi?id=247475 rdar://101943721 Reviewed by Myles C. Maxfield. Unify WGSL AST node type introspection to use TypeCastTraits, replacing the ".isNodeKind()" call pattern with "is<NodeKind>(...)" to complement "downcast<NodeKind>(...)". * Source/WebGPU/WGSL/AST/AST.h: * Source/WebGPU/WGSL/AST/ASTArrayAccess.h: * Source/WebGPU/WGSL/AST/ASTAssignmentStatement.h: * Source/WebGPU/WGSL/AST/ASTAttribute.h: (WGSL::AST::Attribute::Attribute): (isType): (WGSL::AST::Attribute::~Attribute): Deleted. (WGSL::AST::Attribute::isGroup const): Deleted. (WGSL::AST::Attribute::isBinding const): Deleted. (WGSL::AST::Attribute::isStage const): Deleted. (WGSL::AST::Attribute::isLocation const): Deleted. (WGSL::AST::Attribute::isBuiltin const): Deleted. (): Deleted. * Source/WebGPU/WGSL/AST/ASTBindingAttribute.h: Copied from Source/WebGPU/WGSL/AST/ASTGlobalDirective.h. * Source/WebGPU/WGSL/AST/ASTBuiltinAttribute.h: Copied from Source/WebGPU/WGSL/AST/ASTGlobalDirective.h. * Source/WebGPU/WGSL/AST/ASTCallableExpression.h: * Source/WebGPU/WGSL/AST/ASTCompoundStatement.h: * Source/WebGPU/WGSL/AST/ASTDecl.h: (WGSL::AST::Decl::Decl): (isType): (WGSL::AST::Decl::~Decl): Deleted. (WGSL::AST::Decl::isVariable const): Deleted. (WGSL::AST::Decl::isStruct const): Deleted. (WGSL::AST::Decl::isFunction const): Deleted. * Source/WebGPU/WGSL/AST/ASTExpression.h: (WGSL::AST::Expression::Expression): (isTypeOf): (WGSL::AST::Expression::~Expression): Deleted. (WGSL::AST::Expression::isBoolLiteral const): Deleted. (WGSL::AST::Expression::isInt32Literal const): Deleted. (WGSL::AST::Expression::isUInt32Literal const): Deleted. (WGSL::AST::Expression::isFloat32Literal const): Deleted. (WGSL::AST::Expression::isAbstractIntLiteral const): Deleted. (WGSL::AST::Expression::isAbstractFloatLiteral const): Deleted. (WGSL::AST::Expression::isIdentifier const): Deleted. (WGSL::AST::Expression::isArrayAccess const): Deleted. (WGSL::AST::Expression::isStructureAccess const): Deleted. (WGSL::AST::Expression::isCallableExpression const): Deleted. (WGSL::AST::Expression::isUnaryExpression const): Deleted. * Source/WebGPU/WGSL/AST/ASTFunctionDecl.h: * Source/WebGPU/WGSL/AST/ASTGlobalDirective.h: (WGSL::AST::GlobalDirective::GlobalDirective): * Source/WebGPU/WGSL/AST/ASTGroupAttribute.h: Copied from Source/WebGPU/WGSL/AST/ASTGlobalDirective.h. * Source/WebGPU/WGSL/AST/ASTIdentifierExpression.h: * Source/WebGPU/WGSL/AST/ASTLiteralExpressions.h: * Source/WebGPU/WGSL/AST/ASTLocationAttribute.h: Copied from Source/WebGPU/WGSL/AST/ASTGlobalDirective.h. * Source/WebGPU/WGSL/AST/ASTNode.h: (WGSL::AST::Node::Node): (WGSL::AST::ASTNode::ASTNode): Deleted. (WGSL::AST::ASTNode::span const): Deleted. * Source/WebGPU/WGSL/AST/ASTReturnStatement.h: * Source/WebGPU/WGSL/AST/ASTShaderModule.h: * Source/WebGPU/WGSL/AST/ASTStageAttribute.h: Copied from Source/WebGPU/WGSL/AST/ASTGlobalDirective.h. * Source/WebGPU/WGSL/AST/ASTStatement.h: (WGSL::AST::Statement::Statement): (isType): (WGSL::AST::Statement::~Statement): Deleted. (WGSL::AST::Statement::isCompound const): Deleted. (WGSL::AST::Statement::isReturn const): Deleted. (WGSL::AST::Statement::isAssignment const): Deleted. (WGSL::AST::Statement::isVariable const): Deleted. * Source/WebGPU/WGSL/AST/ASTStructureAccess.h: * Source/WebGPU/WGSL/AST/ASTStructureDecl.h: * Source/WebGPU/WGSL/AST/ASTTypeDecl.h: (WGSL::AST::TypeDecl::TypeDecl): (isType): (WGSL::AST::TypeDecl::~TypeDecl): Deleted. (WGSL::AST::TypeDecl::isArray const): Deleted. (WGSL::AST::TypeDecl::isNamed const): Deleted. (WGSL::AST::TypeDecl::isParameterized const): Deleted. * Source/WebGPU/WGSL/AST/ASTUnaryExpression.h: * Source/WebGPU/WGSL/AST/ASTVariableDecl.h: * Source/WebGPU/WGSL/AST/ASTVariableQualifier.h: * Source/WebGPU/WGSL/AST/ASTVariableStatement.h: * Source/WebGPU/WGSL/AST/ASTVisitor.cpp: (WGSL::AST::Visitor::visit): * Source/WebGPU/WGSL/Parser.cpp: * Source/WebGPU/WebGPU.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WGSL/ConstLiteralTests.cpp: (TestWGSLAPI::TEST): * Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp: (checkBuiltin): (checkIntLiteral): (checkVecType): (TestWGSLAPI::TEST): Canonical link: https://commits.webkit.org/256381@main
6fbed13 to
4805542
Compare
|
Committed 256381@main (4805542): https://commits.webkit.org/256381@main Reviewed commits have been landed. Closing PR #6123 and removing active labels. |
4805542
6fbed13