summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-clone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-clone.cpp')
-rw-r--r--source/slang/slang-ir-clone.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/slang/slang-ir-clone.cpp b/source/slang/slang-ir-clone.cpp
index a6c462501..c8b0ba401 100644
--- a/source/slang/slang-ir-clone.cpp
+++ b/source/slang/slang-ir-clone.cpp
@@ -134,9 +134,8 @@ static void _cloneInstDecorationsAndChildren(
// We will set up an IR builder that inserts
// into the new parent instruction.
//
- IRBuilder builderStorage;
+ IRBuilder builderStorage(sharedBuilder);
auto builder = &builderStorage;
- builder->sharedBuilder = sharedBuilder;
builder->setInsertInto(newInst);
// If `newInst` already has non-decoration children, we want to
@@ -264,7 +263,7 @@ IRInst* cloneInst(
env->mapOldValToNew.Add(oldInst, newInst);
cloneInstDecorationsAndChildren(
- env, builder->sharedBuilder, oldInst, newInst);
+ env, builder->getSharedBuilder(), oldInst, newInst);
return newInst;
}
@@ -274,11 +273,8 @@ void cloneDecoration(
IRInst* newParent,
IRModule* module)
{
- SharedIRBuilder sharedBuilder;
- sharedBuilder.module = module;
-
- IRBuilder builder;
- builder.sharedBuilder = &sharedBuilder;
+ SharedIRBuilder sharedBuilder(module);
+ IRBuilder builder(sharedBuilder);
if(auto first = newParent->getFirstDecorationOrChild())
builder.setInsertBefore(first);