blob: 4624a2f9ecfbb230c35ff8600f3d55bf96f6df67 (
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
34
35
36
37
38
|
#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:
case kIROp_DebugInlinedAt:
case kIROp_DebugScope:
case kIROp_DebugNoScope:
case kIROp_DebugFunction:
case kIROp_DebugBuildIdentifier:
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
|