tint: Use ProgramBuilder::CallStmt()
Change-Id: I963d1c859b5bbb8d86f67194e7c0963dfc0e5b29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118985
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/inspector/inspector_test.cc b/src/tint/inspector/inspector_test.cc
index 61e7a88..1c0ecca 100644
--- a/src/tint/inspector/inspector_test.cc
+++ b/src/tint/inspector/inspector_test.cc
@@ -2058,9 +2058,7 @@
AddReferenceFunc("ub_bar_func", "ub_bar");
AddReferenceFunc("ub_baz_func", "ub_baz");
- auto FuncCall = [&](const std::string& callee) {
- return create<ast::CallStatement>(Call(callee));
- };
+ auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -2239,9 +2237,7 @@
AddReferenceFunc("sb_bar_func", "sb_bar");
AddReferenceFunc("sb_baz_func", "sb_baz");
- auto FuncCall = [&](const std::string& callee) {
- return create<ast::CallStatement>(Call(callee));
- };
+ auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -2464,9 +2460,7 @@
AddReferenceFunc("sb_bar_func", "sb_bar");
AddReferenceFunc("sb_baz_func", "sb_baz");
- auto FuncCall = [&](const std::string& callee) {
- return create<ast::CallStatement>(Call(callee));
- };
+ auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{
diff --git a/src/tint/reader/spirv/function.cc b/src/tint/reader/spirv/function.cc
index 5592f1c..c2cb28a 100644
--- a/src/tint/reader/spirv/function.cc
+++ b/src/tint/reader/spirv/function.cc
@@ -5212,7 +5212,7 @@
}
if (result_type->Is<Void>()) {
- return nullptr != AddStatement(create<ast::CallStatement>(Source{}, call_expr));
+ return nullptr != AddStatement(builder_.CallStmt(Source{}, call_expr));
}
return EmitConstDefOrWriteToHoistedVar(inst, {result_type, call_expr});
@@ -5246,14 +5246,14 @@
if (memory != uint32_t(spv::Scope::Workgroup)) {
return Fail() << "workgroupBarrier requires workgroup memory scope";
}
- AddStatement(create<ast::CallStatement>(builder_.Call("workgroupBarrier")));
+ AddStatement(builder_.CallStmt(builder_.Call("workgroupBarrier")));
semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::WorkgroupMemory);
}
if (semantics & uint32_t(spv::MemorySemanticsMask::UniformMemory)) {
if (memory != uint32_t(spv::Scope::Device)) {
return Fail() << "storageBarrier requires device memory scope";
}
- AddStatement(create<ast::CallStatement>(builder_.Call("storageBarrier")));
+ AddStatement(builder_.CallStmt(builder_.Call("storageBarrier")));
semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::UniformMemory);
}
if (semantics) {
@@ -5675,7 +5675,7 @@
} else {
// It's an image write. No value is returned, so make a statement out
// of the call.
- AddStatement(create<ast::CallStatement>(Source{}, call_expr));
+ AddStatement(builder_.CallStmt(Source{}, call_expr));
}
return success();
}
@@ -5803,7 +5803,7 @@
TypedExpression expr{result_type, call};
return EmitConstDefOrWriteToHoistedVar(inst, expr);
}
- AddStatement(create<ast::CallStatement>(call));
+ AddStatement(builder_.CallStmt(call));
return true;
};
diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc
index c72db34..2e36f5c 100644
--- a/src/tint/reader/wgsl/parser_impl.cc
+++ b/src/tint/reader/wgsl/parser_impl.cc
@@ -2434,7 +2434,7 @@
return Failure::kErrored;
}
- return create<ast::CallStatement>(
+ return builder_.CallStmt(
t.source(),
create<ast::CallExpression>(
t.source(),
diff --git a/src/tint/resolver/side_effects_test.cc b/src/tint/resolver/side_effects_test.cc
index b7d27c0..b4770e4 100644
--- a/src/tint/resolver/side_effects_test.cc
+++ b/src/tint/resolver/side_effects_test.cc
@@ -218,7 +218,7 @@
attrs.Push(WorkgroupSize(Expr(1_u)));
}
- stmts.Push(create<ast::CallStatement>(expr));
+ stmts.Push(CallStmt(expr));
Func("func", utils::Empty, ty.void_(), stmts, attrs);