tint: Deprecated module-scope 'let' for 'const'

Enable the parsing of 'const'.
Warn on use of module-scope 'let', and automatically replace with 'const'.

Fixed: tint:1580
Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-06-29 00:55:36 +00:00
committed by Dawn LUCI CQ
parent 03f88e6f49
commit c64ca23d94
224 changed files with 1443 additions and 2495 deletions

View File

@@ -0,0 +1,7 @@
const a : i32 = 1;
const a__ : i32 = 2;
fn f() {
const b = a;
const b__ = a__;
}

View File

@@ -0,0 +1,9 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,6 @@
#include <metal_stdlib>
using namespace metal;
void f() {
}

View File

@@ -0,0 +1,21 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 7
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,8 @@
const a : i32 = 1;
const a__ : i32 = 2;
fn f() {
const b = a;
const b__ = a__;
}

View File

@@ -1,7 +1,6 @@
let a : i32 = 1;
let a__ : i32 = 2;
fn f() {
let a = 1;
let a__ = a;
let b = a;
let b__ = a__;
}

View File

@@ -4,10 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
const int a = 1;
const int a__ = 2;
void f() {
int a = 1;
int b = a;
int b__ = a__;
int b__ = a;
}

View File

@@ -3,10 +3,8 @@ void unused_entry_point() {
return;
}
static const int a = 1;
static const int a__ = 2;
void f() {
const int a = 1;
const int b = a;
const int b__ = a__;
const int b__ = a;
}

View File

@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
constant int a = 1;
constant int a__ = 2;
void f() {
int const a = 1;
int const a__ = a;
int const b = a;
int const b__ = a__;
}

View File

@@ -1,26 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 10
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %a "a"
OpName %a__ "a__"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%int = OpTypeInt 32 1
%a = OpConstant %int 1
%a__ = OpConstant %int 2
%void = OpTypeVoid
%4 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %4
%7 = OpLabel
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %4
%9 = OpLabel
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -1,8 +1,6 @@
let a : i32 = 1;
let a__ : i32 = 2;
fn f() {
let a = 1;
let a__ = a;
let b = a;
let b__ = a__;
}

View File

@@ -0,0 +1,7 @@
const a : i32 = 1;
const _a : i32 = 2;
fn f() {
const b = a;
const _b = _a;
}

View File

@@ -0,0 +1,9 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
}

View File

@@ -0,0 +1,6 @@
#include <metal_stdlib>
using namespace metal;
void f() {
}

View File

@@ -0,0 +1,21 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 7
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,8 @@
const a : i32 = 1;
const _a : i32 = 2;
fn f() {
const b = a;
const _b = _a;
}

View File

@@ -1,7 +1,6 @@
let a : i32 = 1;
let _a : i32 = 2;
fn f() {
let a = 1;
let _a = a;
let b = a;
let _b = _a;
}

View File

@@ -4,10 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
const int a = 1;
const int _a = 2;
void f() {
int a = 1;
int b = a;
int _b = _a;
int _b = a;
}

View File

@@ -3,10 +3,8 @@ void unused_entry_point() {
return;
}
static const int a = 1;
static const int _a = 2;
void f() {
const int a = 1;
const int b = a;
const int _b = _a;
const int _b = a;
}

View File

@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
constant int a = 1;
constant int _a = 2;
void f() {
int const a = 1;
int const _a = a;
int const b = a;
int const _b = _a;
}

View File

@@ -1,26 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 10
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %a "a"
OpName %_a "_a"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%int = OpTypeInt 32 1
%a = OpConstant %int 1
%_a = OpConstant %int 2
%void = OpTypeVoid
%4 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %4
%7 = OpLabel
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %4
%9 = OpLabel
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -1,8 +1,6 @@
let a : i32 = 1;
let _a : i32 = 2;
fn f() {
let a = 1;
let _a = a;
let b = a;
let _b = _a;
}

View File

@@ -1,7 +1,6 @@
let A : i32 = 1;
let _A : i32 = 2;
fn f() {
let A : i32 = 1;
let _A : i32 = 2;
let B = A;
let _B = _A;
}

View File

@@ -4,10 +4,8 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
const int A = 1;
const int _A = 2;
void f() {
int B = A;
int _B = _A;
int B = 1;
int _B = 2;
}

View File

@@ -3,10 +3,7 @@ void unused_entry_point() {
return;
}
static const int A = 1;
static const int _A = 2;
void f() {
const int B = A;
const int _B = _A;
const int B = 1;
const int _B = 2;
}

View File

@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
constant int A = 1;
constant int _A = 2;
void f() {
int const A = 1;
int const _A = 2;
int const B = A;
int const _B = _A;
}

View File

@@ -7,20 +7,18 @@
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %A "A"
OpName %_A "_A"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%int = OpTypeInt 32 1
%A = OpConstant %int 1
%_A = OpConstant %int 2
%void = OpTypeVoid
%4 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %4
%7 = OpLabel
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %4
%9 = OpLabel
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -1,8 +1,6 @@
let A : i32 = 1;
let _A : i32 = 2;
fn f() {
let A : i32 = 1;
let _A : i32 = 2;
let B = A;
let _B = _A;
}