[clang] 9120ade - Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (#112767)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 18 10:19:51 PDT 2024
Author: Daniel Paoliello
Date: 2024-10-18T10:19:48-07:00
New Revision: 9120adea504981dfd55ace25825f84018543d6f2
URL: https://github.com/llvm/llvm-project/commit/9120adea504981dfd55ace25825f84018543d6f2
DIFF: https://github.com/llvm/llvm-project/commit/9120adea504981dfd55ace25825f84018543d6f2.diff
LOG: 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 <mizvekov at gmail.com>
Added:
Modified:
clang/lib/Sema/SemaHLSL.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 1d18a6308e2a50..c6627b0e993226 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -102,8 +102,10 @@ static ResourceClass getResourceClass(RegisterType RT) {
return ResourceClass::Sampler;
case RegisterType::C:
case RegisterType::I:
- llvm_unreachable("unexpected RegisterType value");
+ // Deliberately falling through to the unreachable below.
+ break;
}
+ llvm_unreachable("unexpected RegisterType value");
}
DeclBindingInfo *ResourceBindings::addDeclBindingInfo(const VarDecl *VD,
More information about the cfe-commits
mailing list