Skip to content
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] Convert AST into string representation #5575

Merged
merged 1 commit into from
Oct 21, 2022

Conversation

djg
Copy link
Contributor

@djg djg commented Oct 20, 2022

7e29ffc

[WGSL] Convert AST into string representation
https://bugs.webkit.org/show_bug.cgi?id=246791
rdar://problem/101366942

Reviewed by Myles C. Maxfield.

As a debugging aid, AST::Dumper converts a given WGSL AST into a string
representation that approximates the original WGSL source code.

Tested by ASTDumperTests.

* Source/WebGPU/WGSL/AST/ASTDumper.cpp: Added.
(WGSL::AST::Indent::Indent):
(WGSL::AST::bumpIndent):
(WGSL::AST::Dumper::visitVector):
(WGSL::AST::Dumper::toString):
(WGSL::AST::Dumper::visit):
(WGSL::AST::dumpNode):
(WGSL::AST::dumpAST):
* Source/WebGPU/WGSL/AST/ASTDumper.h: Added.
* Source/WebGPU/WGSL/AST/ASTVisitor.cpp:
(WGSL::AST::Visitor::visit):
* Source/WebGPU/WGSL/AST/ASTVisitor.h:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WGSL/ASTDumperTests.cpp: Added.
(TestWGSLAPI::toString):
(TestWGSLAPI::TEST):
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:
(logCompilationError): Deleted.
* Tools/TestWebKitAPI/Tests/WGSL/TestWGSLAPI.cpp: Added.
(TestWGSLAPI::logCompilationError):
* Tools/TestWebKitAPI/Tests/WGSL/TestWGSLAPI.h: Added.

Canonical link: https://commits.webkit.org/255812@main

a5e873c

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios   πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk   πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios   πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim   πŸ§ͺ mac-wk2
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim   πŸ§ͺ mac-wk2-stress

@djg djg self-assigned this Oct 20, 2022
@djg djg added Other WebGPU For bugs in WebGPU labels Oct 20, 2022
@djg djg requested review from litherum and grorg October 20, 2022 21:35
Source/WebGPU/WGSL/AST/ASTDumper.cpp Outdated Show resolved Hide resolved
Source/WebGPU/WGSL/AST/ASTDumper.cpp Outdated Show resolved Hide resolved
Source/WebGPU/WGSL/AST/ASTDumper.h Outdated Show resolved Hide resolved
Source/WebGPU/WGSL/AST/ASTVisitor.h Show resolved Hide resolved
Tools/TestWebKitAPI/Tests/WGSL/ASTDumperTests.cpp Outdated Show resolved Hide resolved
Source/WebGPU/WGSL/AST/ASTDumper.cpp Outdated Show resolved Hide resolved
@djg djg added the merge-queue Applied to send a pull request to merge-queue label Oct 21, 2022
https://bugs.webkit.org/show_bug.cgi?id=246791
rdar://problem/101366942

Reviewed by Myles C. Maxfield.

As a debugging aid, AST::Dumper converts a given WGSL AST into a string
representation that approximates the original WGSL source code.

Tested by ASTDumperTests.

* Source/WebGPU/WGSL/AST/ASTDumper.cpp: Added.
(WGSL::AST::Indent::Indent):
(WGSL::AST::bumpIndent):
(WGSL::AST::Dumper::visitVector):
(WGSL::AST::Dumper::toString):
(WGSL::AST::Dumper::visit):
(WGSL::AST::dumpNode):
(WGSL::AST::dumpAST):
* Source/WebGPU/WGSL/AST/ASTDumper.h: Added.
* Source/WebGPU/WGSL/AST/ASTVisitor.cpp:
(WGSL::AST::Visitor::visit):
* Source/WebGPU/WGSL/AST/ASTVisitor.h:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WGSL/ASTDumperTests.cpp: Added.
(TestWGSLAPI::toString):
(TestWGSLAPI::TEST):
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:
(logCompilationError): Deleted.
* Tools/TestWebKitAPI/Tests/WGSL/TestWGSLAPI.cpp: Added.
(TestWGSLAPI::logCompilationError):
* Tools/TestWebKitAPI/Tests/WGSL/TestWGSLAPI.h: Added.

Canonical link: https://commits.webkit.org/255812@main
@webkit-commit-queue
Copy link
Collaborator

Committed 255812@main (7e29ffc): https://commits.webkit.org/255812@main

Reviewed commits have been landed. Closing PR #5575 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 7e29ffc into WebKit:main Oct 21, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 21, 2022
@djg djg deleted the wgsl/ast-dumper branch October 24, 2022 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebGPU For bugs in WebGPU
Projects
None yet
4 participants