summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-strip-debug-info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-strip-debug-info.cpp')
-rw-r--r--source/slang/slang-ir-strip-debug-info.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/slang/slang-ir-strip-debug-info.cpp b/source/slang/slang-ir-strip-debug-info.cpp
new file mode 100644
index 000000000..8b2a07663
--- /dev/null
+++ b/source/slang/slang-ir-strip-debug-info.cpp
@@ -0,0 +1,33 @@
+#include "slang-ir-strip-debug-info.h"
+
+#include "slang-ir-insts.h"
+
+namespace Slang
+{
+static void findDebugInfo(IRInst* inst, List<IRInst*>& debugInstructions)
+{
+ switch (inst->getOp())
+ {
+ case kIROp_DebugValue:
+ case kIROp_DebugVar:
+ case kIROp_DebugLine:
+ case kIROp_DebugLocationDecoration:
+ case kIROp_DebugSource:
+ debugInstructions.add(inst);
+ break;
+ default:
+ break;
+ }
+
+ for (auto child : inst->getChildren())
+ findDebugInfo(child, debugInstructions);
+}
+
+void stripDebugInfo(IRModule* irModule)
+{
+ List<IRInst*> debugInstructions;
+ findDebugInfo(irModule->getModuleInst(), debugInstructions);
+ for (auto debugInst : debugInstructions)
+ debugInst->removeAndDeallocate();
+}
+} // namespace Slang