mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
ast: Add Source argument to literals
Bug: tint:396 Bug: tint:390 Change-Id: Ib78c19533dc65c85e2381bf1ce0d0966dd7babe9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35019 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
604bc72dd9
commit
5ed161b2d9
@@ -105,13 +105,15 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
|
||||
} else if (val >= int32_t(size)) {
|
||||
val = int32_t(size) - 1;
|
||||
}
|
||||
lit = ctx->mod->create<ast::SintLiteral>(ctx->Clone(sint->type()), val);
|
||||
lit = ctx->mod->create<ast::SintLiteral>(ctx->Clone(sint->source()),
|
||||
ctx->Clone(sint->type()), val);
|
||||
} else if (auto* uint = lit->As<ast::UintLiteral>()) {
|
||||
uint32_t val = uint->value();
|
||||
if (val >= size - 1) {
|
||||
val = size - 1;
|
||||
}
|
||||
lit = ctx->mod->create<ast::UintLiteral>(ctx->Clone(uint->type()), val);
|
||||
lit = ctx->mod->create<ast::UintLiteral>(ctx->Clone(uint->source()),
|
||||
ctx->Clone(uint->type()), val);
|
||||
} else {
|
||||
diag::Diagnostic err;
|
||||
err.severity = diag::Severity::Error;
|
||||
@@ -132,7 +134,7 @@ ast::ArrayAccessorExpression* BoundArrayAccessors::Transform(
|
||||
params.push_back(
|
||||
ctx->mod->create<ast::TypeConstructorExpression>(u32, cast_expr));
|
||||
params.push_back(ctx->mod->create<ast::ScalarConstructorExpression>(
|
||||
ctx->mod->create<ast::UintLiteral>(u32, size - 1)));
|
||||
ctx->mod->create<ast::UintLiteral>(Source{}, u32, size - 1)));
|
||||
|
||||
auto* call_expr = ctx->mod->create<ast::CallExpression>(
|
||||
ctx->mod->create<ast::IdentifierExpression>(
|
||||
|
||||
@@ -66,7 +66,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
|
||||
|
||||
// Build the AST expression & statement for assigning pointsize one.
|
||||
auto* one = mod->create<ast::ScalarConstructorExpression>(
|
||||
mod->create<ast::FloatLiteral>(f32, 1.0f));
|
||||
mod->create<ast::FloatLiteral>(Source{}, f32, 1.0f));
|
||||
auto* pointsize_ident = mod->create<ast::IdentifierExpression>(
|
||||
Source{}, mod->RegisterSymbol(kPointSizeVar), kPointSizeVar);
|
||||
auto* pointsize_assign =
|
||||
|
||||
@@ -353,7 +353,7 @@ void VertexPulling::State::AddVertexPullingPreamble(
|
||||
|
||||
ast::Expression* VertexPulling::State::GenUint(uint32_t value) {
|
||||
return mod->create<ast::ScalarConstructorExpression>(
|
||||
mod->create<ast::UintLiteral>(GetU32Type(), value));
|
||||
mod->create<ast::UintLiteral>(Source{}, GetU32Type(), value));
|
||||
}
|
||||
|
||||
ast::Expression* VertexPulling::State::CreatePullingPositionIdent() {
|
||||
|
||||
Reference in New Issue
Block a user