summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index c8d76569f..1b11f8165 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -997,12 +997,15 @@ void sortBlocksInFunc(IRGlobalValueWithCode* func)
block->insertAtEnd(func);
}
-void removeLinkageDecorations(IRGlobalValueWithCode* func)
+void removeLinkageDecorations(IRInst* inst)
{
+ if (!inst)
+ return;
+
List<IRInst*> toRemove;
- for (auto inst : func->getDecorations())
+ for (auto decoration : inst->getDecorations())
{
- switch (inst->getOp())
+ switch (decoration->getOp())
{
case kIROp_ImportDecoration:
case kIROp_ExportDecoration:
@@ -1013,14 +1016,14 @@ void removeLinkageDecorations(IRGlobalValueWithCode* func)
case kIROp_CudaDeviceExportDecoration:
case kIROp_DllExportDecoration:
case kIROp_HLSLExportDecoration:
- toRemove.add(inst);
+ toRemove.add(decoration);
break;
default:
break;
}
}
- for (auto inst : toRemove)
- inst->removeAndDeallocate();
+ for (auto decoration : toRemove)
+ decoration->removeAndDeallocate();
}
void setInsertBeforeOrdinaryInst(IRBuilder* builder, IRInst* inst)