r345862 - Replace two fallthrough annotations after covered switch with unreachable
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 1 10:51:48 PDT 2018
Author: rnk
Date: Thu Nov 1 10:51:48 2018
New Revision: 345862
URL: http://llvm.org/viewvc/llvm-project?rev=345862&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=345862&r1=345861&r2=345862&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Nov 1 10:51:48 2018
@@ -11143,9 +11143,7 @@ static ICEDiag CheckICE(const Expr* E, c
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, c
return Worst(LHSResult, RHSResult);
}
}
- LLVM_FALLTHROUGH;
+ llvm_unreachable("invalid binary operator kind");
}
case Expr::ImplicitCastExprClass:
case Expr::CStyleCastExprClass:
More information about the cfe-commits
mailing list