Skip to content

Commit 9120ade

Browse files
dpaoliellomizvekov
andauthored
Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (#112767)
Moves the existing `llvm_unreachable` statement to the bottom of the function and changes the case statement to deliberately fall through to it. Build break was introduced by #111203 It was not caught by the builders as they use Visual Studio 2019, whereas this warning only appears in 2022. --------- Co-authored-by: Matheus Izvekov <[email protected]>
1 parent 6264288 commit 9120ade

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ static ResourceClass getResourceClass(RegisterType RT) {
102102
return ResourceClass::Sampler;
103103
case RegisterType::C:
104104
case RegisterType::I:
105-
llvm_unreachable("unexpected RegisterType value");
105+
// Deliberately falling through to the unreachable below.
106+
break;
106107
}
108+
llvm_unreachable("unexpected RegisterType value");
107109
}
108110

109111
DeclBindingInfo *ResourceBindings::addDeclBindingInfo(const VarDecl *VD,

0 commit comments

Comments
 (0)