Add SkSL unit test for unbraced blocks that optimize away.
In most cases, this works properly and a `;` is emitted, but in one
particular case (int x, y;) we get nothing.
Change-Id: If88d92502f6a533284dd4e0f78daedaf1481ff3d
Bug: skia:11218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359558
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/sksl/shared/EmptyBlocks.glsl b/tests/sksl/shared/EmptyBlocks.glsl
new file mode 100644
index 0000000..bbf7347
--- /dev/null
+++ b/tests/sksl/shared/EmptyBlocks.glsl
@@ -0,0 +1,12 @@
+
+vec4 main() {
+ vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
+ for (int counter = 0;counter < 10; ++counter) ;
+ for (int counter = 0;counter < 10; ++counter)
+ for (int counter = 0;counter < 10; ++counter) ;
+ if (sqrt(1.0) == 1.0) color.y = 1.0;
+ if (sqrt(1.0) == 2.0) ; else color.w = 1.0;
+ while (sqrt(1.0) == 2.0) ;
+ do ; while (sqrt(1.0) == 2.0);
+ return color;
+}