Rename the IntLiteral to SintLiteral.

This Cl clarifies that IntLiteral is a signed value, which matches with
the usage of UintLiteral.

Change-Id: Ic8f0e2382cb66eb6b09daed096886dcc55e6b0f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22540
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc
index 29a952e..623ac51 100644
--- a/src/reader/spirv/parser_impl.cc
+++ b/src/reader/spirv/parser_impl.cc
@@ -39,8 +39,8 @@
 #include "src/ast/builtin_decoration.h"
 #include "src/ast/decorated_variable.h"
 #include "src/ast/float_literal.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/struct.h"
 #include "src/ast/struct_decoration.h"
 #include "src/ast/struct_member.h"
@@ -882,7 +882,7 @@
   }
   if (ast_type->IsI32()) {
     return {ast_type, std::make_unique<ast::ScalarConstructorExpression>(
-                          std::make_unique<ast::IntLiteral>(
+                          std::make_unique<ast::SintLiteral>(
                               ast_type, spirv_const->GetS32()))};
   }
   if (ast_type->IsF32()) {
@@ -954,7 +954,7 @@
   }
   if (type->IsI32()) {
     return std::make_unique<ast::ScalarConstructorExpression>(
-        std::make_unique<ast::IntLiteral>(type, 0));
+        std::make_unique<ast::SintLiteral>(type, 0));
   }
   if (type->IsF32()) {
     return std::make_unique<ast::ScalarConstructorExpression>(
diff --git a/src/reader/wgsl/lexer_test.cc b/src/reader/wgsl/lexer_test.cc
index 12170dc..9bed255 100644
--- a/src/reader/wgsl/lexer_test.cc
+++ b/src/reader/wgsl/lexer_test.cc
@@ -201,7 +201,7 @@
   Lexer l(std::string(params.input));
 
   auto t = l.next();
-  EXPECT_TRUE(t.IsIntLiteral());
+  EXPECT_TRUE(t.IsSintLiteral());
   EXPECT_EQ(t.line(), 1u);
   EXPECT_EQ(t.column(), 1u);
   EXPECT_EQ(t.to_i32(), params.result);
@@ -308,7 +308,7 @@
   Lexer l(params.input);
 
   auto t = l.next();
-  EXPECT_TRUE(t.IsIntLiteral());
+  EXPECT_TRUE(t.IsSintLiteral());
   EXPECT_EQ(t.to_i32(), params.result);
   EXPECT_EQ(1u, t.line());
   EXPECT_EQ(1u, t.column());
@@ -328,7 +328,7 @@
   Lexer l(GetParam());
 
   auto t = l.next();
-  EXPECT_FALSE(t.IsIntLiteral());
+  EXPECT_FALSE(t.IsSintLiteral());
   EXPECT_FALSE(t.IsUintLiteral());
 }
 INSTANTIATE_TEST_SUITE_P(LexerTest,
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index 36d82e4..038e397 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -34,13 +34,13 @@
 #include "src/ast/float_literal.h"
 #include "src/ast/identifier_expression.h"
 #include "src/ast/if_statement.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/kill_statement.h"
 #include "src/ast/location_decoration.h"
 #include "src/ast/member_accessor_expression.h"
 #include "src/ast/return_statement.h"
 #include "src/ast/scalar_constructor_expression.h"
 #include "src/ast/set_decoration.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/statement_condition.h"
 #include "src/ast/struct_member_offset_decoration.h"
 #include "src/ast/switch_statement.h"
@@ -497,7 +497,7 @@
     next();  // consume the peek
 
     t = next();
-    if (!t.IsIntLiteral()) {
+    if (!t.IsSintLiteral()) {
       set_error(t, "invalid value for location decoration");
       return {};
     }
@@ -525,7 +525,7 @@
     next();  // consume the peek
 
     t = next();
-    if (!t.IsIntLiteral()) {
+    if (!t.IsSintLiteral()) {
       set_error(t, "invalid value for binding decoration");
       return {};
     }
@@ -536,7 +536,7 @@
     next();  // consume the peek
 
     t = next();
-    if (!t.IsIntLiteral()) {
+    if (!t.IsSintLiteral()) {
       set_error(t, "invalid value for set decoration");
       return {};
     }
@@ -837,7 +837,7 @@
   uint32_t size = 0;
   if (t.IsComma()) {
     t = next();
-    if (!t.IsIntLiteral()) {
+    if (!t.IsSintLiteral()) {
       set_error(t, "missing size of array declaration");
       return nullptr;
     }
@@ -1143,7 +1143,7 @@
   next();  // Consume the peek
 
   t = next();
-  if (!t.IsIntLiteral()) {
+  if (!t.IsSintLiteral()) {
     set_error(t, "invalid value for offset decoration");
     return nullptr;
   }
@@ -2741,13 +2741,13 @@
     }
     return std::make_unique<ast::BoolLiteral>(type, false);
   }
-  if (t.IsIntLiteral()) {
+  if (t.IsSintLiteral()) {
     next();  // Consume the peek
     auto* type = ctx_.type_mgr().Get(std::make_unique<ast::type::I32Type>());
     if (!type) {
       return nullptr;
     }
-    return std::make_unique<ast::IntLiteral>(type, t.to_i32());
+    return std::make_unique<ast::SintLiteral>(type, t.to_i32());
   }
   if (t.IsUintLiteral()) {
     next();  // Consume the peek
diff --git a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
index efbd731..b91122f 100644
--- a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
+++ b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc
@@ -15,8 +15,8 @@
 #include "gtest/gtest.h"
 #include "src/ast/array_accessor_expression.h"
 #include "src/ast/identifier_expression.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/unary_op_expression.h"
 #include "src/reader/wgsl/parser_impl.h"
 #include "src/reader/wgsl/parser_impl_test_helper.h"
diff --git a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
index 9624223..fd7778f 100644
--- a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
+++ b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc
@@ -16,10 +16,10 @@
 #include "src/ast/array_accessor_expression.h"
 #include "src/ast/assignment_statement.h"
 #include "src/ast/identifier_expression.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/literal.h"
 #include "src/ast/member_accessor_expression.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/reader/wgsl/parser_impl.h"
 #include "src/reader/wgsl/parser_impl_test_helper.h"
 
@@ -47,8 +47,8 @@
 
   auto* init = e->rhs()->AsConstructor()->AsScalarConstructor();
   ASSERT_NE(init->literal(), nullptr);
-  ASSERT_TRUE(init->literal()->IsInt());
-  EXPECT_EQ(init->literal()->AsInt()->value(), 123);
+  ASSERT_TRUE(init->literal()->IsSint());
+  EXPECT_EQ(init->literal()->AsSint()->value(), 123);
 }
 
 TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) {
@@ -65,8 +65,8 @@
   ASSERT_TRUE(e->rhs()->AsConstructor()->IsScalarConstructor());
   auto* init = e->rhs()->AsConstructor()->AsScalarConstructor();
   ASSERT_NE(init->literal(), nullptr);
-  ASSERT_TRUE(init->literal()->IsInt());
-  EXPECT_EQ(init->literal()->AsInt()->value(), 123);
+  ASSERT_TRUE(init->literal()->IsSint());
+  EXPECT_EQ(init->literal()->AsSint()->value(), 123);
 
   ASSERT_TRUE(e->lhs()->IsMemberAccessor());
   auto* mem = e->lhs()->AsMemberAccessor();
@@ -82,8 +82,8 @@
   ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
   init = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
   ASSERT_NE(init->literal(), nullptr);
-  ASSERT_TRUE(init->literal()->IsInt());
-  EXPECT_EQ(init->literal()->AsInt()->value(), 2);
+  ASSERT_TRUE(init->literal()->IsSint());
+  EXPECT_EQ(init->literal()->AsSint()->value(), 2);
 
   ASSERT_TRUE(ary->array()->IsMemberAccessor());
   mem = ary->array()->AsMemberAccessor();
diff --git a/src/reader/wgsl/parser_impl_const_literal_test.cc b/src/reader/wgsl/parser_impl_const_literal_test.cc
index 74bc6e2..3a5420a 100644
--- a/src/reader/wgsl/parser_impl_const_literal_test.cc
+++ b/src/reader/wgsl/parser_impl_const_literal_test.cc
@@ -15,7 +15,7 @@
 #include "gtest/gtest.h"
 #include "src/ast/bool_literal.h"
 #include "src/ast/float_literal.h"
-#include "src/ast/int_literal.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/uint_literal.h"
 #include "src/reader/wgsl/parser_impl.h"
 #include "src/reader/wgsl/parser_impl_test_helper.h"
@@ -30,8 +30,8 @@
   auto c = p->const_literal();
   ASSERT_FALSE(p->has_error());
   ASSERT_NE(c, nullptr);
-  ASSERT_TRUE(c->IsInt());
-  EXPECT_EQ(c->AsInt()->value(), -234);
+  ASSERT_TRUE(c->IsSint());
+  EXPECT_EQ(c->AsSint()->value(), -234);
 }
 
 TEST_F(ParserImplTest, ConstLiteral_Uint) {
diff --git a/src/reader/wgsl/parser_impl_postfix_expression_test.cc b/src/reader/wgsl/parser_impl_postfix_expression_test.cc
index 960bdf3..9baf8a6 100644
--- a/src/reader/wgsl/parser_impl_postfix_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_postfix_expression_test.cc
@@ -16,9 +16,9 @@
 #include "src/ast/array_accessor_expression.h"
 #include "src/ast/call_expression.h"
 #include "src/ast/identifier_expression.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/member_accessor_expression.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/unary_op_expression.h"
 #include "src/reader/wgsl/parser_impl.h"
 #include "src/reader/wgsl/parser_impl_test_helper.h"
@@ -44,8 +44,8 @@
   ASSERT_TRUE(ary->idx_expr()->IsConstructor());
   ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
   auto* c = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(c->literal()->IsInt());
-  EXPECT_EQ(c->literal()->AsInt()->value(), 1);
+  ASSERT_TRUE(c->literal()->IsSint());
+  EXPECT_EQ(c->literal()->AsSint()->value(), 1);
 }
 
 TEST_F(ParserImplTest, PostfixExpression_Array_ExpressionIndex) {
diff --git a/src/reader/wgsl/parser_impl_primary_expression_test.cc b/src/reader/wgsl/parser_impl_primary_expression_test.cc
index 1be32d7..a5fd1d9 100644
--- a/src/reader/wgsl/parser_impl_primary_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_primary_expression_test.cc
@@ -18,8 +18,8 @@
 #include "src/ast/bool_literal.h"
 #include "src/ast/cast_expression.h"
 #include "src/ast/identifier_expression.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/type/f32_type.h"
 #include "src/ast/type/i32_type.h"
 #include "src/ast/type_constructor_expression.h"
@@ -76,26 +76,26 @@
   ASSERT_TRUE(val[0]->IsConstructor());
   ASSERT_TRUE(val[0]->AsConstructor()->IsScalarConstructor());
   auto* ident = val[0]->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(ident->literal()->IsInt());
-  EXPECT_EQ(ident->literal()->AsInt()->value(), 1);
+  ASSERT_TRUE(ident->literal()->IsSint());
+  EXPECT_EQ(ident->literal()->AsSint()->value(), 1);
 
   ASSERT_TRUE(val[1]->IsConstructor());
   ASSERT_TRUE(val[1]->AsConstructor()->IsScalarConstructor());
   ident = val[1]->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(ident->literal()->IsInt());
-  EXPECT_EQ(ident->literal()->AsInt()->value(), 2);
+  ASSERT_TRUE(ident->literal()->IsSint());
+  EXPECT_EQ(ident->literal()->AsSint()->value(), 2);
 
   ASSERT_TRUE(val[2]->IsConstructor());
   ASSERT_TRUE(val[2]->AsConstructor()->IsScalarConstructor());
   ident = val[2]->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(ident->literal()->IsInt());
-  EXPECT_EQ(ident->literal()->AsInt()->value(), 3);
+  ASSERT_TRUE(ident->literal()->IsSint());
+  EXPECT_EQ(ident->literal()->AsSint()->value(), 3);
 
   ASSERT_TRUE(val[3]->IsConstructor());
   ASSERT_TRUE(val[3]->AsConstructor()->IsScalarConstructor());
   ident = val[3]->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(ident->literal()->IsInt());
-  EXPECT_EQ(ident->literal()->AsInt()->value(), 4);
+  ASSERT_TRUE(ident->literal()->IsSint());
+  EXPECT_EQ(ident->literal()->AsSint()->value(), 4);
 }
 
 TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidTypeDecl) {
diff --git a/src/reader/wgsl/parser_impl_unary_expression_test.cc b/src/reader/wgsl/parser_impl_unary_expression_test.cc
index fad15fc..0484162 100644
--- a/src/reader/wgsl/parser_impl_unary_expression_test.cc
+++ b/src/reader/wgsl/parser_impl_unary_expression_test.cc
@@ -15,8 +15,8 @@
 #include "gtest/gtest.h"
 #include "src/ast/array_accessor_expression.h"
 #include "src/ast/identifier_expression.h"
-#include "src/ast/int_literal.h"
 #include "src/ast/scalar_constructor_expression.h"
+#include "src/ast/sint_literal.h"
 #include "src/ast/unary_op_expression.h"
 #include "src/reader/wgsl/parser_impl.h"
 #include "src/reader/wgsl/parser_impl_test_helper.h"
@@ -41,8 +41,8 @@
   ASSERT_TRUE(ary->idx_expr()->IsConstructor());
   ASSERT_TRUE(ary->idx_expr()->AsConstructor()->IsScalarConstructor());
   auto* init = ary->idx_expr()->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(init->literal()->IsInt());
-  ASSERT_EQ(init->literal()->AsInt()->value(), 2);
+  ASSERT_TRUE(init->literal()->IsSint());
+  ASSERT_EQ(init->literal()->AsSint()->value(), 2);
 }
 
 TEST_F(ParserImplTest, UnaryExpression_Minus) {
@@ -59,8 +59,8 @@
   ASSERT_TRUE(u->expr()->AsConstructor()->IsScalarConstructor());
 
   auto* init = u->expr()->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(init->literal()->IsInt());
-  EXPECT_EQ(init->literal()->AsInt()->value(), 1);
+  ASSERT_TRUE(init->literal()->IsSint());
+  EXPECT_EQ(init->literal()->AsSint()->value(), 1);
 }
 
 TEST_F(ParserImplTest, UnaryExpression_Minus_InvalidRHS) {
@@ -85,8 +85,8 @@
   ASSERT_TRUE(u->expr()->AsConstructor()->IsScalarConstructor());
 
   auto* init = u->expr()->AsConstructor()->AsScalarConstructor();
-  ASSERT_TRUE(init->literal()->IsInt());
-  EXPECT_EQ(init->literal()->AsInt()->value(), 1);
+  ASSERT_TRUE(init->literal()->IsSint());
+  EXPECT_EQ(init->literal()->AsSint()->value(), 1);
 }
 
 TEST_F(ParserImplTest, UnaryExpression_Bang_InvalidRHS) {
diff --git a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
index 3a8b29f..b3144ef 100644
--- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
@@ -69,7 +69,7 @@
   ASSERT_EQ(type, nullptr);
 
   auto t = p->next();
-  ASSERT_TRUE(t.IsIntLiteral());
+  ASSERT_TRUE(t.IsSintLiteral());
 }
 
 TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) {
diff --git a/src/reader/wgsl/token.cc b/src/reader/wgsl/token.cc
index 2976a95..a845d99 100644
--- a/src/reader/wgsl/token.cc
+++ b/src/reader/wgsl/token.cc
@@ -33,8 +33,8 @@
       return "kStringLiteral";
     case Token::Type::kFloatLiteral:
       return "kFloatLiteral";
-    case Token::Type::kIntLiteral:
-      return "kIntLiteral";
+    case Token::Type::kSintLiteral:
+      return "kSintLiteral";
     case Token::Type::kUintLiteral:
       return "kUintLiteral";
     case Token::Type::kUninitialized:
@@ -247,7 +247,7 @@
     : type_(Type::kUintLiteral), source_(source), val_uint_(val) {}
 
 Token::Token(const Source& source, int32_t val)
-    : type_(Type::kIntLiteral), source_(source), val_int_(val) {}
+    : type_(Type::kSintLiteral), source_(source), val_int_(val) {}
 
 Token::Token(const Source& source, float val)
     : type_(Type::kFloatLiteral), source_(source), val_float_(val) {}
@@ -266,7 +266,7 @@
   if (type_ == Type::kFloatLiteral) {
     return std::to_string(val_float_);
   }
-  if (type_ == Type::kIntLiteral) {
+  if (type_ == Type::kSintLiteral) {
     return std::to_string(val_int_);
   }
   if (type_ == Type::kUintLiteral) {
diff --git a/src/reader/wgsl/token.h b/src/reader/wgsl/token.h
index f5a2c5f..cca501b 100644
--- a/src/reader/wgsl/token.h
+++ b/src/reader/wgsl/token.h
@@ -46,9 +46,9 @@
     kStringLiteral,
     /// A float value
     kFloatLiteral,
-    /// An int value
-    kIntLiteral,
-    /// A uint value
+    /// An signed int value
+    kSintLiteral,
+    /// A unsigned int value
     kUintLiteral,
 
     /// A '&'
@@ -305,8 +305,8 @@
   bool IsStringLiteral() const { return type_ == Type::kStringLiteral; }
   /// @returns true if the token is a float
   bool IsFloatLiteral() const { return type_ == Type::kFloatLiteral; }
-  /// @returns true if the token is an int
-  bool IsIntLiteral() const { return type_ == Type::kIntLiteral; }
+  /// @returns true if the token is an signed int
+  bool IsSintLiteral() const { return type_ == Type::kSintLiteral; }
   /// @returns true if the token is a unsigned int
   bool IsUintLiteral() const { return type_ == Type::kUintLiteral; }