[webkit-changes] [WebKit/WebKit] 480554: [WGSL] Unify AST node type traits

Dan Glastonbury noreply at github.com
Sun Nov 6 16:55:53 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 480554208313ebcb878ee7ef315bc94d9b628e0b
      https://github.com/WebKit/WebKit/commit/480554208313ebcb878ee7ef315bc94d9b628e0b
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2022-11-06 (Sun, 06 Nov 2022)

  Changed paths:
    M Source/WebGPU/WGSL/AST/AST.h
    M Source/WebGPU/WGSL/AST/ASTArrayAccess.h
    M Source/WebGPU/WGSL/AST/ASTAssignmentStatement.h
    M Source/WebGPU/WGSL/AST/ASTAttribute.h
    A Source/WebGPU/WGSL/AST/ASTBindingAttribute.h
    A Source/WebGPU/WGSL/AST/ASTBuiltinAttribute.h
    M Source/WebGPU/WGSL/AST/ASTCallableExpression.h
    M Source/WebGPU/WGSL/AST/ASTCompoundStatement.h
    M Source/WebGPU/WGSL/AST/ASTDecl.h
    M Source/WebGPU/WGSL/AST/ASTExpression.h
    M Source/WebGPU/WGSL/AST/ASTFunctionDecl.h
    M Source/WebGPU/WGSL/AST/ASTGlobalDirective.h
    A Source/WebGPU/WGSL/AST/ASTGroupAttribute.h
    M Source/WebGPU/WGSL/AST/ASTIdentifierExpression.h
    M Source/WebGPU/WGSL/AST/ASTLiteralExpressions.h
    A Source/WebGPU/WGSL/AST/ASTLocationAttribute.h
    M Source/WebGPU/WGSL/AST/ASTNode.h
    M Source/WebGPU/WGSL/AST/ASTReturnStatement.h
    M Source/WebGPU/WGSL/AST/ASTShaderModule.h
    A Source/WebGPU/WGSL/AST/ASTStageAttribute.h
    M Source/WebGPU/WGSL/AST/ASTStatement.h
    M Source/WebGPU/WGSL/AST/ASTStructureAccess.h
    M Source/WebGPU/WGSL/AST/ASTStructureDecl.h
    M Source/WebGPU/WGSL/AST/ASTTypeDecl.h
    M Source/WebGPU/WGSL/AST/ASTUnaryExpression.h
    M Source/WebGPU/WGSL/AST/ASTVariableDecl.h
    M Source/WebGPU/WGSL/AST/ASTVariableQualifier.h
    M Source/WebGPU/WGSL/AST/ASTVariableStatement.h
    M Source/WebGPU/WGSL/AST/ASTVisitor.cpp
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WGSL/ConstLiteralTests.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Unify AST node type traits
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




More information about the webkit-changes mailing list