[clang] Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (PR #112767)
Daniel Paoliello via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 12:25:29 PDT 2024
https://github.com/dpaoliello created https://github.com/llvm/llvm-project/pull/112767
Adds a default case to the switch to the existing `llvm_unreachable` statement.
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.
>From 20f602b8c28d966a7cc957a3ca4c6ed43e71258e Mon Sep 17 00:00:00 2001
From: "Daniel Paoliello (HE/HIM)" <danpao at microsoft.com>
Date: Thu, 17 Oct 2024 12:21:25 -0700
Subject: [PATCH] Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715:
'getResourceClass': not all control paths return a value
---
clang/lib/Sema/SemaHLSL.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index efb0fbaa432d76..50f0a553bc86e3 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -102,6 +102,7 @@ static ResourceClass getResourceClass(RegisterType RT) {
return ResourceClass::Sampler;
case RegisterType::C:
case RegisterType::I:
+ default:
llvm_unreachable("unexpected RegisterType value");
}
}
More information about the cfe-commits
mailing list