]> granicus.if.org Git - clang/commitdiff
Eliminate more pointless default statements
authorDouglas Gregor <dgregor@apple.com>
Tue, 30 Nov 2010 19:14:03 +0000 (19:14 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 30 Nov 2010 19:14:03 +0000 (19:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120446 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp

index 196a4c8caa52e0eac9a53ff227fc09c8b7d44b87..136480b1ccaf83cdbcaa3a05b2108beb7c5a87f3 100644 (file)
@@ -849,8 +849,10 @@ TypeWithKeyword::getTagTypeKindForTypeSpec(unsigned TypeSpec) {
   case TST_struct: return TTK_Struct;
   case TST_union: return TTK_Union;
   case TST_enum: return TTK_Enum;
-  default: llvm_unreachable("Type specifier is not a tag type kind.");
   }
+  
+  llvm_unreachable("Type specifier is not a tag type kind.");
+  return TTK_Union;
 }
 
 ElaboratedTypeKeyword
@@ -896,7 +898,6 @@ TypeWithKeyword::KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword) {
 const char*
 TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) {
   switch (Keyword) {
-  default: llvm_unreachable("Unknown elaborated type keyword.");
   case ETK_None: return "";
   case ETK_Typename: return "typename";
   case ETK_Class:  return "class";
@@ -904,6 +905,9 @@ TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) {
   case ETK_Union:  return "union";
   case ETK_Enum:   return "enum";
   }
+
+  llvm_unreachable("Unknown elaborated type keyword.");
+  return "";
 }
 
 ElaboratedType::~ElaboratedType() {}
@@ -956,11 +960,13 @@ bool Type::isElaboratedTypeSpecifier() const {
 
 const char *Type::getTypeClassName() const {
   switch (TypeBits.TC) {
-  default: assert(0 && "Type class not in TypeNodes.def!");
 #define ABSTRACT_TYPE(Derived, Base)
 #define TYPE(Derived, Base) case Derived: return #Derived;
 #include "clang/AST/TypeNodes.def"
   }
+  
+  llvm_unreachable("Invalid type class.");
+  return 0;
 }
 
 const char *BuiltinType::getName(const LangOptions &LO) const {
@@ -995,6 +1001,7 @@ const char *BuiltinType::getName(const LangOptions &LO) const {
   case ObjCClass:         return "Class";
   case ObjCSel:           return "SEL";
   }
+  
   llvm_unreachable("Invalid builtin type.");
   return 0;
 }
@@ -1019,8 +1026,9 @@ QualType QualType::getNonLValueExprType(ASTContext &Context) const {
 
 llvm::StringRef FunctionType::getNameForCallConv(CallingConv CC) {
   switch (CC) {
-  case CC_Default: llvm_unreachable("no name for default cc");
-  default: return "";
+  case CC_Default: 
+    llvm_unreachable("no name for default cc");
+    return "";
 
   case CC_C: return "cdecl";
   case CC_X86StdCall: return "stdcall";
@@ -1028,6 +1036,9 @@ llvm::StringRef FunctionType::getNameForCallConv(CallingConv CC) {
   case CC_X86ThisCall: return "thiscall";
   case CC_X86Pascal: return "pascal";
   }
+
+  llvm_unreachable("Invalid calling convention.");
+  return "";
 }
 
 FunctionProtoType::FunctionProtoType(QualType Result, const QualType *ArgArray,