[PATCH] D154882: [DirectX] Fix two "not all control paths return a value" warnings

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 13:19:42 PDT 2023


bogner created this revision.
bogner added reviewers: beanz, python3kgae.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: All.
bogner requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These switch statements are fully covered. Add an llvm_unreachable so
that compilers that don't recognize that don't warn.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154882

Files:
  llvm/lib/Target/DirectX/DXILResource.cpp


Index: llvm/lib/Target/DirectX/DXILResource.cpp
===================================================================
--- llvm/lib/Target/DirectX/DXILResource.cpp
+++ llvm/lib/Target/DirectX/DXILResource.cpp
@@ -105,6 +105,7 @@
   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 @@
   case Kinds::FeedbackTexture2DArray:
     return "fbtex2darray";
   }
+  llvm_unreachable("All Kinds enums are handled in switch");
 }
 
 void ResourceBase::printKind(Kinds Kind, unsigned Alignment, raw_ostream &OS,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154882.538791.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230710/cea169c0/attachment.bin>


More information about the llvm-commits mailing list