@@ -32,20 +32,20 @@ namespace {
3232// / PIMPL state for the transform.
3333struct State {
3434 // / The IR module.
35- Module* ir = nullptr ;
35+ Module& ir;
3636
3737 // / The IR builder.
38- Builder b{* ir};
38+ Builder b{ir};
3939
4040 // / The type manager.
41- core::type::Manager& ty{ir-> Types ()};
41+ core::type::Manager& ty{ir. Types ()};
4242
4343 // / Process the module.
4444 void Process () {
4545 // Find module-scope variables that need to be replaced.
46- if (ir-> root_block ) {
46+ if (ir. root_block ) {
4747 Vector<Instruction*, 4 > to_remove;
48- for (auto inst : *ir-> root_block ) {
48+ for (auto inst : *ir. root_block ) {
4949 auto * var = inst->As <Var>();
5050 if (!var) {
5151 continue ;
@@ -67,7 +67,7 @@ struct State {
6767 }
6868
6969 // Find function parameters that need to be replaced.
70- for (auto * func : ir-> functions ) {
70+ for (auto * func : ir. functions ) {
7171 for (uint32_t index = 0 ; index < func->Params ().Length (); index++) {
7272 auto * param = func->Params ()[index];
7373 auto * storage_texture = param->Type ()->As <core::type::StorageTexture>();
@@ -90,8 +90,8 @@ struct State {
9090 auto bp = old_var->BindingPoint ();
9191 new_var->SetBindingPoint (bp->group , bp->binding );
9292 new_var->InsertBefore (old_var);
93- if (auto name = ir-> NameOf (old_var)) {
94- ir-> SetName (new_var, name.NameView ());
93+ if (auto name = ir. NameOf (old_var)) {
94+ ir. SetName (new_var, name.NameView ());
9595 }
9696
9797 // Replace all uses of the old variable with the new one.
@@ -111,8 +111,8 @@ struct State {
111111 auto * rgba8 = ty.Get <core::type::StorageTexture>(
112112 bgra8->dim (), core::TexelFormat::kRgba8Unorm , bgra8->access (), bgra8->type ());
113113 auto * new_param = b.FunctionParam (rgba8);
114- if (auto name = ir-> NameOf (old_param)) {
115- ir-> SetName (new_param, name.NameView ());
114+ if (auto name = ir. NameOf (old_param)) {
115+ ir. SetName (new_param, name.NameView ());
116116 }
117117
118118 Vector<FunctionParam*, 4 > new_params = func->Params ();
@@ -170,8 +170,8 @@ struct State {
170170
171171} // namespace
172172
173- Result<SuccessType> Bgra8UnormPolyfill (Module* ir) {
174- auto result = ValidateAndDumpIfNeeded (* ir, " Bgra8UnormPolyfill transform" );
173+ Result<SuccessType> Bgra8UnormPolyfill (Module& ir) {
174+ auto result = ValidateAndDumpIfNeeded (ir, " Bgra8UnormPolyfill transform" );
175175 if (!result) {
176176 return result;
177177 }
0 commit comments