From: Reid Kleckner Date: Thu, 1 Nov 2018 17:51:48 +0000 (+0000) Subject: Replace two fallthrough annotations after covered switch with unreachable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1922b72e59653574119dccf7ca509b7dd1a30bf8;p=clang Replace two fallthrough annotations after covered switch with unreachable Both preceding switches handle all possible enumerators, so the fallthrough is actually unreachable. This strengthens that to an assertion. The first instance had a comment from 2010 indicating that fallthrough was possible, but that was back when we had a unary operator for offsetof. Now it is its own expression kind, so the annotation was stale. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345862 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index bf08d6bb65..15efe433bd 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -11143,9 +11143,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) { case UO_Imag: return CheckICE(Exp->getSubExpr(), Ctx); } - - // OffsetOf falls through here. - LLVM_FALLTHROUGH; + llvm_unreachable("invalid unary operator class"); } case Expr::OffsetOfExprClass: { // Note that per C99, offsetof must be an ICE. And AFAIK, using @@ -11249,7 +11247,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) { return Worst(LHSResult, RHSResult); } } - LLVM_FALLTHROUGH; + llvm_unreachable("invalid binary operator kind"); } case Expr::ImplicitCastExprClass: case Expr::CStyleCastExprClass: