[clang] [clang][amdgpu] mapCABIAtomicOrdering - fix MSVC not all control paths return a value warning. NFC. (PR #180500)

Thibault Monnier via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 9 03:43:34 PST 2026


================
@@ -290,6 +290,7 @@ static llvm::AtomicOrdering mapCABIAtomicOrdering(unsigned AO) {
   case llvm::AtomicOrderingCABI::relaxed:
     return llvm::AtomicOrdering::Monotonic;
   }
+  llvm_unreachable("Unknown AtomicOrderingCABI enum");
----------------
Thibault-Monnier wrote:

It seems to me there is only a warning when enabling `-Wswitch-enum`, but then, that's basically the point of the flag.

What gcc _does_ do is that it never considers a `switch case` without a `default` as handling all control paths, see https://godbolt.org/z/E8PcGoPv6. However, that's not applicable in this case. 

https://github.com/llvm/llvm-project/pull/180500


More information about the cfe-commits mailing list