diff options
| author | Yong He <yonghe@outlook.com> | 2024-10-20 09:28:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-20 09:28:13 -0700 |
| commit | 307315a7305e76529837fd1cdb677f534d5f539b (patch) | |
| tree | ba39e96ba2e9b3d62d1213aab2f1cc54febe451a /source/slang/slang-emit-c-like.cpp | |
| parent | 9936178dd3efb026bfa142512a2bf061d7a75ab5 (diff) | |
Properly check switch case. (#5341)
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index dd5cb88d3..a2795675d 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -3232,7 +3232,7 @@ void CLikeSourceEmitter::emitLayoutSemantics(IRInst* inst, char const* uniformSe emitLayoutSemanticsImpl(inst, uniformSemanticSpelling, EmitLayoutSemanticOption::kPostType); } -void CLikeSourceEmitter::emitSwitchCaseSelectorsImpl(IRBasicType *const /* switchCondition */, const SwitchRegion::Case *const currentCase, const bool isDefault) +void CLikeSourceEmitter::emitSwitchCaseSelectorsImpl(const SwitchRegion::Case* currentCase, bool isDefault) { for(auto caseVal : currentCase->values) { @@ -3401,9 +3401,8 @@ void CLikeSourceEmitter::emitRegion(Region* inRegion) auto defaultCase = switchRegion->defaultCase; for(auto currentCase : switchRegion->cases) { - const bool isDefault {currentCase.Ptr() == defaultCase}; - IRBasicType *const switchConditionType {as<IRBasicType>(switchRegion->getCondition()->getDataType())}; - emitSwitchCaseSelectors(switchConditionType, currentCase.Ptr(), isDefault); + bool isDefault = (currentCase.Ptr() == defaultCase); + emitSwitchCaseSelectors(currentCase.Ptr(), isDefault); m_writer->indent(); m_writer->emit("{\n"); m_writer->indent(); |
