[llvm] r292246 - [TLI] Appease spurious MSVC warning using llvm_unreachable. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 11:54:18 PST 2017

Author: ab
Date: Tue Jan 17 13:54:18 2017
New Revision: 292246

URL: http://llvm.org/viewvc/llvm-project?rev=292246&view=rev
[TLI] Appease spurious MSVC warning using llvm_unreachable. NFC.

r292188 confused MSVC because of the combined lack of a default
case and return statement.

Move the unreachable outside of the NumLibFuncs case, to make it
obvious that all cases should be handled.

llvm_unreachable is __declspec(noreturn), so I'm assuming this
does appease MSVC.


Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=292246&r1=292245&r2=292246&view=diff
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Tue Jan 17 13:54:18 2017
@@ -1177,9 +1177,10 @@ bool TargetLibraryInfoImpl::isValidProto
             FTy.getParamType(1) == SizeTTy && FTy.getParamType(2) == SizeTTy);
   case LibFunc::NumLibFuncs:
-    llvm_unreachable("Invalid sentinel libfunc value");
+    break;
+  llvm_unreachable("Invalid libfunc");
 bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl,

More information about the llvm-commits mailing list