]> granicus.if.org Git - clang/commitdiff
Fix enumerator not handled in switch warnings.
authorFrancois Pichet <pichet2000@gmail.com>
Tue, 7 Dec 2010 00:55:57 +0000 (00:55 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Tue, 7 Dec 2010 00:55:57 +0000 (00:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121084 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtPrinter.cpp
lib/Parse/ParseExprCXX.cpp

index b1f6df37cc1c640de4448b53c0ff307a39fc1027..f17ff0b6591e2c31b323aa51bae21651075edcef 100644 (file)
@@ -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 "";
 }
 
index 964205b18f93144128895b6e025fb3b04bbdeefc..9d6023e7f4f6179cb7d25449d1136b66935b977c 100644 (file)
@@ -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