From: Francois Pichet Date: Tue, 7 Dec 2010 00:55:57 +0000 (+0000) Subject: Fix enumerator not handled in switch warnings. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38c2b730a8553fa1cf369d0c5567f8b5d0a3dda8;p=clang Fix enumerator not handled in switch warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121084 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index b1f6df37cc..f17ff0b659 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -1206,6 +1206,7 @@ void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) { static const char *getTypeTraitName(UnaryTypeTrait UTT) { switch (UTT) { + default: llvm_unreachable("Unknown unary type trait"); case UTT_HasNothrowAssign: return "__has_nothrow_assign"; case UTT_HasNothrowCopy: return "__has_nothrow_copy"; case UTT_HasNothrowConstructor: return "__has_nothrow_constructor"; @@ -1222,15 +1223,14 @@ static const char *getTypeTraitName(UnaryTypeTrait UTT) { case UTT_IsPolymorphic: return "__is_polymorphic"; case UTT_IsUnion: return "__is_union"; } - llvm_unreachable("Unknown unary type trait"); return ""; } static const char *getTypeTraitName(BinaryTypeTrait BTT) { switch (BTT) { + default: llvm_unreachable("Unknown binary type trait"); case BTT_IsBaseOf: return "__is_base_of"; } - llvm_unreachable("Unknown binary type trait"); return ""; } diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 964205b18f..9d6023e7f4 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1800,6 +1800,7 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) { static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) { switch(kind) { + default: llvm_unreachable("Not a known unary type trait"); case tok::kw___has_nothrow_assign: return UTT_HasNothrowAssign; case tok::kw___has_nothrow_copy: return UTT_HasNothrowCopy; case tok::kw___has_nothrow_constructor: return UTT_HasNothrowConstructor; @@ -1817,14 +1818,13 @@ static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) { case tok::kw___is_union: return UTT_IsUnion; case tok::kw___is_literal: return UTT_IsLiteral; } - llvm_unreachable("Not a known unary type trait"); } static BinaryTypeTrait BinaryTypeTraitFromTokKind(tok::TokenKind kind) { switch(kind) { + default: llvm_unreachable("Not a known binary type trait"); case tok::kw___is_base_of: return BTT_IsBaseOf; } - llvm_unreachable("Not a known binary type trait"); } /// ParseUnaryTypeTrait - Parse the built-in unary type-trait