summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-strip.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/slang/slang-ir-strip.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/slang/slang-ir-strip.cpp')
-rw-r--r--source/slang/slang-ir-strip.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/source/slang/slang-ir-strip.cpp b/source/slang/slang-ir-strip.cpp
index 505e7ce76..6d83cd310 100644
--- a/source/slang/slang-ir-strip.cpp
+++ b/source/slang/slang-ir-strip.cpp
@@ -1,35 +1,29 @@
// slang-ir-strip.cpp
#include "slang-ir-strip.h"
-#include "slang-ir.h"
#include "slang-ir-insts.h"
+#include "slang-ir.h"
-namespace Slang {
+namespace Slang
+{
- /// Should `inst` be stripped, given the current `options`?
-static bool _shouldStripInst(
- IRInst* inst,
- IRStripOptions const& options)
+/// Should `inst` be stripped, given the current `options`?
+static bool _shouldStripInst(IRInst* inst, IRStripOptions const& options)
{
- switch( inst->getOp() )
+ switch (inst->getOp())
{
- default:
- return false;
+ default: return false;
- case kIROp_HighLevelDeclDecoration:
- return true;
+ case kIROp_HighLevelDeclDecoration: return true;
- case kIROp_NameHintDecoration:
- return options.shouldStripNameHints;
+ case kIROp_NameHintDecoration: return options.shouldStripNameHints;
}
}
- /// Recursively strip `inst` and its children according to `options`.
-static void _stripFrontEndOnlyInstructionsRec(
- IRInst* inst,
- IRStripOptions const& options)
+/// Recursively strip `inst` and its children according to `options`.
+static void _stripFrontEndOnlyInstructionsRec(IRInst* inst, IRStripOptions const& options)
{
- if( _shouldStripInst(inst, options) )
+ if (_shouldStripInst(inst, options))
{
inst->removeAndDeallocate();
return;
@@ -41,7 +35,7 @@ static void _stripFrontEndOnlyInstructionsRec(
}
IRInst* nextChild = nullptr;
- for( IRInst* child = inst->getFirstDecorationOrChild(); child; child = nextChild )
+ for (IRInst* child = inst->getFirstDecorationOrChild(); child; child = nextChild)
{
nextChild = child->getNextInst();
@@ -49,11 +43,9 @@ static void _stripFrontEndOnlyInstructionsRec(
}
}
-void stripFrontEndOnlyInstructions(
- IRModule* module,
- IRStripOptions const& options)
+void stripFrontEndOnlyInstructions(IRModule* module, IRStripOptions const& options)
{
_stripFrontEndOnlyInstructionsRec(module->getModuleInst(), options);
}
-}
+} // namespace Slang