blob: 8b2a07663237a6ee21fe5ec8bc08949f413faca7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|