Change to assert(0,x) to llvm_unreachable(x)

This avoids fall-through error in opt mode:
error: unannotated fall-through between switch labels
[-Werror,-Wimplicit-fallthrough]
PiperOrigin-RevId: 203616256
This commit is contained in:
Jacques Pienaar 2018-07-07 15:48:05 -07:00 committed by jpienaar
parent 67c03193de
commit f9da10ce45
2 changed files with 2 additions and 2 deletions

View File

@ -227,7 +227,7 @@ void MLFunctionState::print(const Statement *stmt) {
os.indent(numSpaces);
switch (stmt->getKind()) {
case Statement::Kind::Operation: // TODO
assert(0 && "Operation statement is not yet implemented");
llvm_unreachable("Operation statement is not yet implemented");
case Statement::Kind::For:
return print(cast<ForStmt>(stmt));
case Statement::Kind::If:

View File

@ -87,7 +87,7 @@ std::string Token::getStringValue() const {
/// literal tokens since they have no fixed spelling.
StringRef Token::getTokenSpelling(Kind kind) {
switch (kind) {
default: assert(0 && "This token kind has no fixed spelling");
default: llvm_unreachable("This token kind has no fixed spelling");
#define TOK_PUNCTUATION(NAME, SPELLING) case NAME: return SPELLING;
#define TOK_OPERATOR(NAME, SPELLING) case NAME: return SPELLING;
#define TOK_KEYWORD(SPELLING) case kw_##SPELLING: return #SPELLING;