Title: [248706] trunk
Revision
248706
Author
mmaxfi...@apple.com
Date
2019-08-14 20:36:22 -0700 (Wed, 14 Aug 2019)

Log Message

[WHLSL] Variables shouldn't be able to have void type
https://bugs.webkit.org/show_bug.cgi?id=200751

Reviewed by Robin Morisset.

Source/WebCore:

Trivial fix. Found by https://github.com/gpuweb/WHLSL/issues/320.

Test: webgpu/whlsl/void-variable-parameter.html

* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::Checker::visit):

LayoutTests:

* webgpu/whlsl/void-variable-parameter-expected.txt: Added.
* webgpu/whlsl/void-variable-parameter.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (248705 => 248706)


--- trunk/LayoutTests/ChangeLog	2019-08-15 02:36:47 UTC (rev 248705)
+++ trunk/LayoutTests/ChangeLog	2019-08-15 03:36:22 UTC (rev 248706)
@@ -1,3 +1,13 @@
+2019-08-14  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WHLSL] Variables shouldn't be able to have void type
+        https://bugs.webkit.org/show_bug.cgi?id=200751
+
+        Reviewed by Robin Morisset.
+
+        * webgpu/whlsl/void-variable-parameter-expected.txt: Added.
+        * webgpu/whlsl/void-variable-parameter.html: Added.
+
 2019-08-14  Zalan Bujtas  <za...@apple.com>
 
         [ContentChangeObserver] Any previously destroyed renderer should not be considered a candidate for content observation.

Added: trunk/LayoutTests/webgpu/whlsl/void-variable-parameter-expected.txt (0 => 248706)


--- trunk/LayoutTests/webgpu/whlsl/void-variable-parameter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl/void-variable-parameter-expected.txt	2019-08-15 03:36:22 UTC (rev 248706)
@@ -0,0 +1,4 @@
+
+PASS voidVariable 
+PASS voidParameter 
+

Added: trunk/LayoutTests/webgpu/whlsl/void-variable-parameter.html (0 => 248706)


--- trunk/LayoutTests/webgpu/whlsl/void-variable-parameter.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl/void-variable-parameter.html	2019-08-15 03:36:22 UTC (rev 248706)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.voidVariable = async () =>
+{
+    await checkFail(
+        `
+            void foo() {
+                void x;
+            }
+        `);
+}
+
+whlslTests.voidParameter = async () =>
+{
+    await checkFail(
+        `
+            void foo(void x) {
+            }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (248705 => 248706)


--- trunk/Source/WebCore/ChangeLog	2019-08-15 02:36:47 UTC (rev 248705)
+++ trunk/Source/WebCore/ChangeLog	2019-08-15 03:36:22 UTC (rev 248706)
@@ -1,3 +1,17 @@
+2019-08-14  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WHLSL] Variables shouldn't be able to have void type
+        https://bugs.webkit.org/show_bug.cgi?id=200751
+
+        Reviewed by Robin Morisset.
+
+        Trivial fix. Found by https://github.com/gpuweb/WHLSL/issues/320.
+
+        Test: webgpu/whlsl/void-variable-parameter.html
+
+        * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
+        (WebCore::WHLSL::Checker::visit):
+
 2019-08-14  Justin Fan  <justin_...@apple.com>
 
         [WebGPU] Use of WebGPU should not force discrete GPU

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp (248705 => 248706)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp	2019-08-15 02:36:47 UTC (rev 248705)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp	2019-08-15 03:36:22 UTC (rev 248706)
@@ -952,6 +952,10 @@
     // ReadModifyWriteExpressions are the only place where anonymous variables exist,
     // and that doesn't recurse on the anonymous variables, so we can assume the variable has a type.
     checkErrorAndVisit(*variableDeclaration.type());
+    if (matches(*variableDeclaration.type(), m_intrinsics.voidType())) {
+        setError(Error("Variables can't have void type.", variableDeclaration.codeLocation()));
+        return;
+    }
     if (variableDeclaration.initializer()) {
         auto& lhsType = *variableDeclaration.type();
         auto initializerInfo = recurseAndGetInfo(*variableDeclaration.initializer());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to