[llvm] 7f9ba19 - [DirectX] Fix two "not all control paths return a value" warnings
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 15:34:57 PDT 2023
Author: Justin Bogner
Date: 2023-07-10T15:34:15-07:00
New Revision: 7f9ba1994a2366dd9cfd61aca9802697ad25adb1
URL: https://github.com/llvm/llvm-project/commit/7f9ba1994a2366dd9cfd61aca9802697ad25adb1
DIFF: https://github.com/llvm/llvm-project/commit/7f9ba1994a2366dd9cfd61aca9802697ad25adb1.diff
LOG: [DirectX] Fix two "not all control paths return a value" warnings
These switch statements are fully covered. Add an llvm_unreachable so
that compilers that don't recognize that don't warn.
Differential Revision: https://reviews.llvm.org/D154882
Added:
Modified:
llvm/lib/Target/DirectX/DXILResource.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/DirectX/DXILResource.cpp b/llvm/lib/Target/DirectX/DXILResource.cpp
index 763432911dbfa2..dde7255e04254e 100644
--- a/llvm/lib/Target/DirectX/DXILResource.cpp
+++ b/llvm/lib/Target/DirectX/DXILResource.cpp
@@ -105,6 +105,7 @@ StringRef ResourceBase::getComponentTypeName(ComponentType CompType) {
case ComponentType::PackedU8x32:
return "p32u8";
}
+ llvm_unreachable("All ComponentType enums are handled in switch");
}
void ResourceBase::printComponentType(Kinds Kind, ComponentType CompType,
@@ -172,6 +173,7 @@ StringRef ResourceBase::getKindName(Kinds Kind) {
case Kinds::FeedbackTexture2DArray:
return "fbtex2darray";
}
+ llvm_unreachable("All Kinds enums are handled in switch");
}
void ResourceBase::printKind(Kinds Kind, unsigned Alignment, raw_ostream &OS,
More information about the llvm-commits
mailing list