Remove tint::Source(size_t, size_t) constructor

This was a temporary overload to break up the changes into smaller chunks.
Change all call sites to use one of the other constructors.

Bug: tint:282
Change-Id: I500fe9700d22f72312827808caa22f7feef7b294
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31440
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-11-02 15:07:47 +00:00
committed by Commit Bot service account
parent 74023424da
commit fc5a9cfaf7
35 changed files with 149 additions and 126 deletions

View File

@@ -474,12 +474,12 @@ bool ParserImpl::ParseInternalModule() {
}
void ParserImpl::RegisterLineNumbers() {
Source::Location instruction_number{0, 0};
Source::Location instruction_number{};
// Has there been an OpLine since the last OpNoLine or start of the module?
bool in_op_line_scope = false;
// The source location provided by the most recent OpLine instruction.
Source::Location op_line_source{0, 0};
Source::Location op_line_source{};
const bool run_on_debug_insts = true;
module_->ForEachInst(
[this, &in_op_line_scope, &op_line_source,

View File

@@ -26,48 +26,48 @@ namespace {
using TokenTest = testing::Test;
TEST_F(TokenTest, ReturnsStr) {
Token t(Token::Type::kStringLiteral, Source{1, 1}, "test string");
Token t(Token::Type::kStringLiteral, Source{}, "test string");
EXPECT_EQ(t.to_str(), "test string");
}
TEST_F(TokenTest, ReturnsF32) {
Token t1(Source{1, 1}, -2.345f);
Token t1(Source{}, -2.345f);
EXPECT_EQ(t1.to_f32(), -2.345f);
Token t2(Source{1, 1}, 2.345f);
Token t2(Source{}, 2.345f);
EXPECT_EQ(t2.to_f32(), 2.345f);
}
TEST_F(TokenTest, ReturnsI32) {
Token t1(Source{1, 1}, -2345);
Token t1(Source{}, -2345);
EXPECT_EQ(t1.to_i32(), -2345);
Token t2(Source{1, 1}, 2345);
Token t2(Source{}, 2345);
EXPECT_EQ(t2.to_i32(), 2345);
}
TEST_F(TokenTest, HandlesMaxI32) {
Token t1(Source{1, 1}, std::numeric_limits<int32_t>::max());
Token t1(Source{}, std::numeric_limits<int32_t>::max());
EXPECT_EQ(t1.to_i32(), std::numeric_limits<int32_t>::max());
}
TEST_F(TokenTest, HandlesMinI32) {
Token t1(Source{1, 1}, std::numeric_limits<int32_t>::min());
Token t1(Source{}, std::numeric_limits<int32_t>::min());
EXPECT_EQ(t1.to_i32(), std::numeric_limits<int32_t>::min());
}
TEST_F(TokenTest, ReturnsU32) {
Token t2(Source{1, 1}, 2345u);
Token t2(Source{}, 2345u);
EXPECT_EQ(t2.to_u32(), 2345u);
}
TEST_F(TokenTest, ReturnsMaxU32) {
Token t1(Source{1, 1}, std::numeric_limits<uint32_t>::max());
Token t1(Source{}, std::numeric_limits<uint32_t>::max());
EXPECT_EQ(t1.to_u32(), std::numeric_limits<uint32_t>::max());
}
TEST_F(TokenTest, Source) {
Token t(Token::Type::kUintLiteral, Source{3, 9});
Token t(Token::Type::kUintLiteral, Source{Source::Location{3, 9}});
EXPECT_EQ(t.line(), 3u);
EXPECT_EQ(t.column(), 9u);
}