]> granicus.if.org Git - clang/commitdiff
Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate...
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 17 Jan 2012 06:56:22 +0000 (06:56 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 17 Jan 2012 06:56:22 +0000 (06:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8

43 files changed:
include/clang/Sema/DeclSpec.h
include/clang/Sema/Overload.h
include/clang/Sema/Sema.h
lib/AST/ASTContext.cpp
lib/Basic/IdentifierTable.cpp
lib/Basic/Module.cpp
lib/Basic/Targets.cpp
lib/Lex/HeaderSearch.cpp
lib/Lex/ModuleMap.cpp
lib/Lex/PPDirectives.cpp
lib/Lex/PPExpressions.cpp
lib/Lex/PreprocessingRecord.cpp
lib/Lex/TokenConcatenation.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/Parser.cpp
lib/Rewrite/HTMLRewrite.cpp
lib/Sema/CodeCompleteConsumer.cpp
lib/Sema/DeclSpec.cpp
lib/Sema/SemaAccess.cpp
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaCast.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaExceptionSpec.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaExprMember.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderStmt.cpp
lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
tools/libclang/CIndex.cpp
tools/libclang/CIndexCXX.cpp
tools/libclang/CIndexCodeCompletion.cpp
tools/libclang/CIndexUSRs.cpp
tools/libclang/CXLoadedDiagnostic.cpp
tools/libclang/CXStoredDiagnostic.cpp
utils/TableGen/NeonEmitter.cpp

index 6a180e85ae6c7eecdbb49ffd33816979deec492f..c4a96e1a3ef790ac12ac0b5b3df99fa628635eb9 100644 (file)
@@ -1747,7 +1747,6 @@ public:
         return !DeclTypeInfo[i].Arr.NumElts;
       }
       llvm_unreachable("Invalid type chunk");
-      return false;
     }
     return false;
   }
@@ -1772,7 +1771,6 @@ public:
         return false;
       }
       llvm_unreachable("Invalid type chunk");
-      return false;
     }
     return false;
   }
index 24adce8f3520f6d7e4ec2400b7e9df260bdb6bca..3fcc56790c6f64c7ebd43f889cfe77839032b0d3 100644 (file)
@@ -469,7 +469,7 @@ namespace clang {
         return 3;
       }
 
-      return 3;
+      llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
     }
 
     bool isBad() const { return getKind() == BadConversion; }
index 24ccba1b251a1e3ebb3ae8f9ba739cdd04f9212f..8b0075fc7787964411b0073a6eaa04e69228c846 100644 (file)
@@ -4846,7 +4846,7 @@ public:
 
       }
 
-      return true;
+      llvm_unreachable("Invalid InstantiationKind!");
     }
 
     friend bool operator!=(const ActiveTemplateInstantiation &X,
index e145eecf425711c29c160b923f2dcff7cdaf09f6..9079dbe2712c5a21f7c44978df5c2ccde976995d 100644 (file)
@@ -193,7 +193,7 @@ CXXABI *ASTContext::createCXXABI(const TargetInfo &T) {
   case CXXABI_Microsoft:
     return CreateMicrosoftCXXABI(*this);
   }
-  return 0;
+  llvm_unreachable("Invalid CXXABI type!");
 }
 
 static const LangAS::Map *getAddressSpaceMap(const TargetInfo &T,
@@ -833,7 +833,6 @@ ASTContext::getTypeInfo(const Type *T) const {
 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
 #include "clang/AST/TypeNodes.def"
     llvm_unreachable("Should not see dependent types");
-    break;
 
   case Type::FunctionNoProto:
   case Type::FunctionProto:
@@ -3407,8 +3406,7 @@ ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const {
     return NNS;
   }
 
-  // Required to silence a GCC warning
-  return 0;
+  llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
 }
 
 
@@ -6087,7 +6085,7 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS,
                                           LHS->getAs<ObjCObjectPointerType>(),
                                           RHS->getAs<ObjCObjectPointerType>(),
                                           BlockReturnType))
-      return LHS;
+        return LHS;
       return QualType();
     }
     if (canAssignObjCInterfaces(LHS->getAs<ObjCObjectPointerType>(),
@@ -6095,10 +6093,10 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS,
       return LHS;
 
     return QualType();
-    }
+  }
   }
 
-  return QualType();
+  llvm_unreachable("Invalid Type::Class!");
 }
 
 bool ASTContext::FunctionTypesMatchOnNSConsumedAttrs(
@@ -6613,7 +6611,7 @@ GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) {
     }
   }
 
-  return GVA_StrongExternal;
+  llvm_unreachable("Invalid Linkage!");
 }
 
 bool ASTContext::DeclMustBeEmitted(const Decl *D) {
index c191456b1ea169a04d1adb1775c9d2d89c1bb0fe..a76a363912df905abde3d261d7fb0c833c9e94b6 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <cstdio>
 
 using namespace clang;
@@ -503,5 +504,5 @@ const char *clang::getOperatorSpelling(OverloadedOperatorKind Operator) {
 #include "clang/Basic/OperatorKinds.def"
   }
 
-  return 0;
+  llvm_unreachable("Invalid OverloadedOperatorKind!");
 }
index c5bc86de81db9f5f68fe593a059cb383f1208a95..ff09441802f6b35aa48ee5f5602f6a3132d96fb1 100644 (file)
@@ -72,7 +72,6 @@ Module::isAvailable(const LangOptions &LangOpts, StringRef &Feature) const {
   }
 
   llvm_unreachable("could not find a reason why module is unavailable");
-  return false;
 }
 
 bool Module::isSubModuleOf(Module *Other) const {
index b6c07567a94a39392d3ffb1c95a8fd47267e995d..9ba743c31f1263ded92d8cb090fe0e4a7d6a3451 100644 (file)
@@ -2103,7 +2103,6 @@ X86TargetInfo::validateAsmConstraint(const char *&Name,
             // x86_64 instructions.
     return true;
   }
-  return false;
 }
 
 
@@ -3397,7 +3396,6 @@ public:
       Info.setAllowsRegister();
       return true;
     }
-    return false;
   }
 
   virtual const char *getClobbers() const {
index 6d2d72fc22d68fed4ecbc7f039ec1ba981d0cb36..7af7c93b7baf80882dd0aac792e8451a352611a2 100644 (file)
@@ -799,8 +799,6 @@ bool HeaderSearch::hasModuleMap(StringRef FileName,
     // having module maps if we eventually do find a module map.
     FixUpDirectories.push_back(Dir);
   } while (true);
-  
-  return false;
 }
 
 Module *HeaderSearch::findModuleForHeader(const FileEntry *File) {
index 745ebc4d8b693b5df4d799a3e9d875a9496800ed..08a1e23d107532a42deb1122e0b8437ce0bdac17 100644 (file)
@@ -1263,8 +1263,6 @@ bool ModuleMapParser::parseModuleMapFile() {
       break;
     }
   } while (true);
-  
-  return HadError;
 }
 
 bool ModuleMap::parseModuleMapFile(const FileEntry *File) {
index 4379b6bad183138807757a90e37bd724e91fb11e..76955604b08a7b826ea97d847b6699d695983a2f 100644 (file)
@@ -1370,7 +1370,6 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
         
     default:
       llvm_unreachable("unknown include directive kind");
-      break;
     }
 
     // Determine whether we are actually building the module that this
index 20f624a0bb12a321b6c8259ce151f3f13931ec45..4ce48e003c9e46c55270aeaa5fe13a534db7eab8 100644 (file)
@@ -703,8 +703,6 @@ static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec,
     LHS.Val = Res;
     LHS.setEnd(RHS.getRange().getEnd());
   }
-
-  return false;
 }
 
 /// EvaluateDirectiveExpression - Evaluate an integer constant expression that
index 770a69d19bb62ec9e8c5b45c8483cd8e67553886..6c36e73ad333bf3514f06e4cdc16fe68be023197 100644 (file)
@@ -390,7 +390,6 @@ void PreprocessingRecord::InclusionDirective(
     
   default:
     llvm_unreachable("Unknown include directive kind");
-    return;
   }
   
   clang::InclusionDirective *ID
index dc6d686d6cc1097b7b2529a43291e34009829b3e..335d864f3f9c01b0f90ea2fd7e365e32b99f8644 100644 (file)
@@ -179,11 +179,9 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok,
   switch (PrevKind) {
   default:
     llvm_unreachable("InitAvoidConcatTokenInfo built wrong");
-    return true;
 
   case tok::raw_identifier:
     llvm_unreachable("tok::raw_identifier in non-raw lexing mode!");
-    return true;
 
   case tok::identifier:   // id+id or id+number or id+L"foo".
     // id+'.'... will not append.
index 3ecdae2978d5d5fe434fb688b3fe184bb2f48663..3f4f4611fd3c89b77e07b6bab56eda685be89058 100644 (file)
@@ -42,7 +42,6 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() {
   switch (Tok.getObjCKeywordID()) {
   case tok::objc_class:
     return ParseObjCAtClassDeclaration(AtLoc);
-    break;
   case tok::objc_interface: {
     ParsedAttributes attrs(AttrFactory);
     SingleDecl = ParseObjCAtInterfaceDeclaration(AtLoc, attrs);
@@ -426,7 +425,6 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
     if (Tok.is(tok::code_completion)) {
       Actions.CodeCompleteObjCAtDirective(getCurScope());
       return cutOffParsing();
-      break;
     }
 
     tok::ObjCKeywordKind DirectiveKind = Tok.getObjCKeywordID();
index fadf34fc4f38e102ec52f52826eeb4f541f11865..cd467dd720f6ae829f880f3a888b38d3ce93426c 100644 (file)
@@ -1934,8 +1934,6 @@ bool Parser::ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
     if (Tok.isNot(tok::comma)) return false;
     ConsumeToken();
   }
-
-  return true;
 }
 
 Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
@@ -2203,7 +2201,6 @@ void Parser::ParseMicrosoftIfExistsStatement(StmtVector &Stmts) {
       
   case IEB_Dependent:
     llvm_unreachable("Dependent case handled above");
-    break;
       
   case IEB_Skip:
     Braces.skipToEnd();
index db9460bca4f9e9c13c5e36b1eeb48f395d04b4fb..501e50c1e79d8d58429e4a025aecb5e14329f3b2 100644 (file)
@@ -581,7 +581,6 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
   }
   case tok::at:
     return ParseObjCAtDirectives();
-    break;
   case tok::minus:
   case tok::plus:
     if (!getLang().ObjC1) {
index ba39602d162b5d15099905789ec49df51a5f5359..ed4974b50e13562f49ca0bbff35ce8d0d704a288 100644 (file)
@@ -381,7 +381,6 @@ void html::SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP) {
     default: break;
     case tok::identifier:
       llvm_unreachable("tok::identifier in raw lexing mode!");
-      break;
     case tok::raw_identifier: {
       // Fill in Result.IdentifierInfo and update the token kind,
       // looking up the identifier in the identifier table.
index 80496c5c44169928640acc98b7044296de1d5f10..f1a63927690c00da621c76e45c2fa3b57329fe88 100644 (file)
@@ -71,8 +71,8 @@ bool CodeCompletionContext::wantConstructorResults() const {
   case CCC_ObjCCategoryName:
     return false;
   }
-  
-  return false;
+
+  llvm_unreachable("Invalid CodeCompletionContext::Kind!");
 }
 
 //===----------------------------------------------------------------------===//
@@ -93,7 +93,6 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text)
 
   case CK_Optional:
     llvm_unreachable("Optional strings cannot be created from text");
-    break;
       
   case CK_LeftParen:
     this->Text = "(";
@@ -330,8 +329,8 @@ CodeCompleteConsumer::OverloadCandidate::getFunctionType() const {
   case CK_FunctionType:
     return Type;
   }
-  
-  return 0;
+
+  llvm_unreachable("Invalid CandidateKind!");
 }
 
 //===----------------------------------------------------------------------===//
index 2b5efc692f4e2df943403b67fc3f8f384943ebf4..11818f6fa24894440ec7cad5e86ff6a13afc61bd 100644 (file)
@@ -245,7 +245,6 @@ bool Declarator::isDeclarationOfFunction() const {
       return false;
     }
     llvm_unreachable("Invalid type chunk");
-    return false;
   }
   
   switch (DS.getTypeSpecType()) {
@@ -295,8 +294,8 @@ bool Declarator::isDeclarationOfFunction() const {
       return QT->isFunctionType();
     }
   }
-  
-  return false;
+
+  llvm_unreachable("Invalid TypeSpecType!");
 }
 
 /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
index e1322ed8a229c959f0e270dde2e161f5038544c2..6014b9b47f89498ea9cce1f274643ed3d1bbadef 100644 (file)
@@ -797,7 +797,6 @@ static AccessResult HasAccess(Sema &S,
 
   // Silence bogus warnings
   llvm_unreachable("impossible friendship kind");
-  return OnFailure;
 }
 
 /// Finds the best path from the naming class to the declaring class,
@@ -1068,7 +1067,6 @@ static void DiagnoseAccessPath(Sema &S,
 
     case AR_dependent:
       llvm_unreachable("can't diagnose dependent access failures");
-      return;
     }
   }
 
@@ -1298,7 +1296,6 @@ static AccessResult CheckEffectiveAccess(Sema &S,
 
   // silence unnecessary warning
   llvm_unreachable("invalid access result");
-  return AR_accessible;
 }
 
 static Sema::AccessResult CheckAccess(Sema &S, SourceLocation Loc,
@@ -1333,7 +1330,6 @@ static Sema::AccessResult CheckAccess(Sema &S, SourceLocation Loc,
   case AR_dependent: return Sema::AR_dependent;
   }
   llvm_unreachable("falling off end");
-  return Sema::AR_accessible;
 }
 
 void Sema::HandleDelayedAccessCheck(DelayedDiagnostic &DD, Decl *decl) {
index 31e33dda08ade58801722838b0ccf5d45540c508..1ad50434dbb89982255b7c340e4a1cb58c70d811 100644 (file)
@@ -150,14 +150,13 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
     const TagType *Tag = NNS->getAsType()->getAs<TagType>();
     assert(Tag && "Non-tag type in nested-name-specifier");
     return Tag->getDecl();
-  } break;
+  }
 
   case NestedNameSpecifier::Global:
     return Context.getTranslationUnitDecl();
   }
 
-  // Required to silence a GCC warning.
-  return 0;
+  llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
 }
 
 bool Sema::isDependentScopeSpecifier(const CXXScopeSpec &SS) {
@@ -899,8 +898,7 @@ bool Sema::ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
     return true;
   }
 
-  // Silence bogus warning.
-  return false;
+  llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
 }
 
 /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
index fe7667e93b3e950699af2b07fe4b9da70710640a..2420424bf2cfcdde6ad1054837fe152898405149 100644 (file)
@@ -295,8 +295,6 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
                                                  OpLoc, Parens.getEnd()));
   }
   }
-
-  return ExprError();
 }
 
 /// Try to diagnose a failed overloaded cast.  Returns true if
@@ -346,7 +344,6 @@ static bool tryDiagnoseOverloadedCast(Sema &S, CastType CT,
 
   switch (sequence.getFailedOverloadResult()) {
   case OR_Success: llvm_unreachable("successful failed overload");
-    return false;
   case OR_No_Viable_Function:
     if (candidates.empty())
       msg = diag::err_ovl_no_conversion_in_cast;
index af0eedd791d8c8e6f18162ebf72b60548b78fea6..e94aa2ffce3f4fa54f9eeb0051ec0a03f2c0cd9d 100644 (file)
@@ -342,7 +342,7 @@ static unsigned RFT(unsigned t, bool shift = false) {
     assert(!shift && "cannot shift float types!");
     return (2 << IsQuad) - 1;
   }
-  return 0;
+  llvm_unreachable("Invalid NeonTypeFlag!");
 }
 
 /// getNeonEltType - Return the QualType corresponding to the elements of
@@ -367,7 +367,7 @@ static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context) {
   case NeonTypeFlags::Float32:
     return Context.FloatTy;
   }
-  return QualType();
+  llvm_unreachable("Invalid NeonTypeFlag!");
 }
 
 bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
index c280ac2990783410d0784fdca04145118ff7350b..730dde8c9e29d86d2018ace8c3f76aff6384eb61 100644 (file)
@@ -596,8 +596,7 @@ SimplifiedTypeClass clang::getSimplifiedTypeClass(CanQualType T) {
       default:
         return STC_Arithmetic;
     }
-    return STC_Other;
-    
+
   case Type::Complex:
     return STC_Arithmetic;
     
@@ -1370,8 +1369,8 @@ static bool WantTypesInContext(Sema::ParserCompletionContext CCC,
   case Sema::PCC_ForInit:
     return LangOpts.CPlusPlus || LangOpts.ObjC1 || LangOpts.C99;
   }
-  
-  return false;
+
+  llvm_unreachable("Invalid ParserCompletionContext!");
 }
 
 static PrintingPolicy getCompletionPrintingPolicy(const ASTContext &Context,
@@ -2793,7 +2792,7 @@ CXCursorKind clang::getCursorKindForDecl(Decl *D) {
     case Decl::ObjCCategory:       return CXCursor_ObjCCategoryDecl;
     case Decl::ObjCCategoryImpl:   return CXCursor_ObjCCategoryImplDecl;
       // FIXME
-      return CXCursor_UnexposedDecl;
+      // return CXCursor_UnexposedDecl;
     case Decl::ObjCImplementation: return CXCursor_ObjCImplementationDecl;
 
     case Decl::ObjCInterface:
@@ -2847,7 +2846,6 @@ CXCursorKind clang::getCursorKindForDecl(Decl *D) {
       case ObjCPropertyImplDecl::Synthesize:
         return CXCursor_ObjCSynthesizeDecl;
       }
-      break;
       
     default:
       if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
@@ -2926,10 +2924,9 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S,
   case Sema::PCC_MemberTemplate:
     if (S.CurContext->isFileContext())
       return CodeCompletionContext::CCC_TopLevel;
-    else if (S.CurContext->isRecord())
+    if (S.CurContext->isRecord())
       return CodeCompletionContext::CCC_ClassStructUnion;
-    else 
-      return CodeCompletionContext::CCC_Other;
+    return CodeCompletionContext::CCC_Other;
       
   case Sema::PCC_RecoveryInFunction:
     return CodeCompletionContext::CCC_Recovery;
@@ -2957,8 +2954,8 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S,
   case Sema::PCC_LocalDeclarationSpecifiers:
     return CodeCompletionContext::CCC_Type;
   }
-  
-  return CodeCompletionContext::CCC_Other;
+
+  llvm_unreachable("Invalid ParserCompletionContext!");
 }
 
 /// \brief If we're in a C++ virtual member function, add completion results
index 43bdf3f93058d03d97af881b65f6f9cce9ca426c..ea736320f8767be7c7d8d39073046cad2d074d30 100644 (file)
@@ -1105,7 +1105,6 @@ static bool hasEffectivelyInternalLinkage(NamedDecl *D) {
     return false;
   }
   llvm_unreachable("unknown linkage kind!");
-  return false;
 }
 
 static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) {
@@ -3007,7 +3006,6 @@ static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) {
   }
   default:
     llvm_unreachable("unexpected attribute kind");
-    return;
   }
 }
 
@@ -3056,7 +3054,7 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC) {
     }
     // FALLS THROUGH
   }
-  default: llvm_unreachable("unexpected attribute kind"); return true;
+  default: llvm_unreachable("unexpected attribute kind");
   }
 
   return false;
@@ -3242,7 +3240,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
   bool typeOK;
   bool cf;
   switch (Attr.getKind()) {
-  default: llvm_unreachable("invalid ownership attribute"); return;
+  default: llvm_unreachable("invalid ownership attribute");
   case AttributeList::AT_ns_returns_autoreleased:
   case AttributeList::AT_ns_returns_retained:
   case AttributeList::AT_ns_returns_not_retained:
index 92af2d914ba07f1090f414d68a20707b31a2ecb3..eb7be5d728f0dc9cd26fb1fe12cb1c05728958f7 100644 (file)
@@ -611,10 +611,8 @@ bool Sema::CheckExceptionSpecSubset(
       case AR_inaccessible: continue;
       case AR_dependent:
         llvm_unreachable("access check dependent for unprivileged context");
-        break;
       case AR_delayed:
         llvm_unreachable("access check delayed in non-declaration");
-        break;
       }
 
       Contained = true;
index 741ca9edd055880882aaeb7c4275d61df7d673be..26ca3a9cc012e151e1e79bd73e425d8378f96437 100644 (file)
@@ -2392,13 +2392,11 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
     case Decl::type:
 #include "clang/AST/DeclNodes.inc"
       llvm_unreachable("invalid value decl kind");
-      return ExprError();
 
     // These shouldn't make it here.
     case Decl::ObjCAtDefsField:
     case Decl::ObjCIvar:
       llvm_unreachable("forming non-member reference to ivar?");
-      return ExprError();
 
     // Enum constants are always r-values and never references.
     // Unresolved using declarations are dependent.
@@ -2519,7 +2517,6 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
   }
 
   llvm_unreachable("unknown capture result");
-  return ExprError();
 }
 
 ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) {
@@ -4090,12 +4087,10 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_ObjCObjectPointer:
       if (SrcKind == Type::STK_ObjCObjectPointer)
         return CK_BitCast;
-      else if (SrcKind == Type::STK_CPointer)
+      if (SrcKind == Type::STK_CPointer)
         return CK_CPointerToObjCPointerCast;
-      else {
-        maybeExtendBlockObject(*this, Src);
-        return CK_BlockPointerToObjCPointerCast;
-      }
+      maybeExtendBlockObject(*this, Src);
+      return CK_BlockPointerToObjCPointerCast;
     case Type::STK_Bool:
       return CK_PointerToBoolean;
     case Type::STK_Integral:
@@ -4106,7 +4101,7 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_MemberPointer:
       llvm_unreachable("illegal cast from pointer");
     }
-    break;
+    llvm_unreachable("Should have returned before this");
 
   case Type::STK_Bool: // casting from bool is like casting from an integer
   case Type::STK_Integral:
@@ -4137,7 +4132,7 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_MemberPointer:
       llvm_unreachable("member pointer type in C");
     }
-    break;
+    llvm_unreachable("Should have returned before this");
 
   case Type::STK_Floating:
     switch (DestTy->getScalarTypeKind()) {
@@ -4164,7 +4159,7 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_MemberPointer:
       llvm_unreachable("member pointer type in C");
     }
-    break;
+    llvm_unreachable("Should have returned before this");
 
   case Type::STK_FloatingComplex:
     switch (DestTy->getScalarTypeKind()) {
@@ -4193,7 +4188,7 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_MemberPointer:
       llvm_unreachable("member pointer type in C");
     }
-    break;
+    llvm_unreachable("Should have returned before this");
 
   case Type::STK_IntegralComplex:
     switch (DestTy->getScalarTypeKind()) {
@@ -4222,7 +4217,7 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     case Type::STK_MemberPointer:
       llvm_unreachable("member pointer type in C");
     }
-    break;
+    llvm_unreachable("Should have returned before this");
   }
 
   llvm_unreachable("Unhandled scalar cast");
@@ -7201,7 +7196,6 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
   case Expr::MLV_ReadonlyProperty:
   case Expr::MLV_NoSetterProperty:
     llvm_unreachable("readonly properties should be processed differently");
-    break;
   case Expr::MLV_InvalidMessageExpression:
     Diag = diag::error_readonly_message_assignment;
     break;
@@ -9924,7 +9918,6 @@ namespace {
 
     ExprResult VisitStmt(Stmt *S) {
       llvm_unreachable("unexpected statement!");
-      return ExprError();
     }
 
     ExprResult VisitExpr(Expr *E) {
@@ -10017,7 +10010,6 @@ namespace {
 
     ExprResult VisitStmt(Stmt *S) {
       llvm_unreachable("unexpected statement!");
-      return ExprError();
     }
 
     ExprResult VisitExpr(Expr *E) {
index 6476f4a512d87646452daaaf7870817b22381a7e..fceb6398077b70109429b8fe490852dbedefa274 100644 (file)
@@ -4786,8 +4786,8 @@ Sema::CheckMicrosoftIfExistsSymbol(Scope *S,
   case LookupResult::NotFoundInCurrentInstantiation:
     return IER_Dependent;
   }
-  
-  return IER_DoesNotExist;  
+
+  llvm_unreachable("Invalid LookupResult Kind!");
 }
 
 Sema::IfExistsResult 
index 0080156376ef95297578d15fa8db18fe015e255d..fb0fc34cf7c140b5085dcfa5a6b11e2bdd878dd4 100644 (file)
@@ -238,7 +238,6 @@ Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
   }
 
   llvm_unreachable("unexpected instance member access kind");
-  return ExprError();
 }
 
 /// Check an ext-vector component access expression.
index cd8505932b4e656fe3d1ceae1f729d40c2881b4b..8a4f6830490fa9ebace6745dd1fdb8718fca4e93 100644 (file)
@@ -2327,8 +2327,7 @@ DeclarationName InitializedEntity::getName() const {
     return DeclarationName();
   }
 
-  // Silence GCC warning
-  return DeclarationName();
+  llvm_unreachable("Invalid EntityKind!");
 }
 
 DeclaratorDecl *InitializedEntity::getDecl() const {
@@ -2353,8 +2352,7 @@ DeclaratorDecl *InitializedEntity::getDecl() const {
     return 0;
   }
 
-  // Silence GCC warning
-  return 0;
+  llvm_unreachable("Invalid EntityKind!");
 }
 
 bool InitializedEntity::allowsNRVO() const {
@@ -2456,7 +2454,7 @@ bool InitializationSequence::isAmbiguous() const {
     return FailedOverloadResult == OR_Ambiguous;
   }
 
-  return false;
+  llvm_unreachable("Invalid EntityKind!");
 }
 
 bool InitializationSequence::isConstructorInitialization() const {
@@ -4263,7 +4261,7 @@ getAssignmentAction(const InitializedEntity &Entity) {
     return Sema::AA_Initializing;
   }
 
-  return Sema::AA_Converting;
+  llvm_unreachable("Invalid EntityKind!");
 }
 
 /// \brief Whether we should binding a created object as a temporary when
@@ -5356,7 +5354,6 @@ bool InitializationSequence::Diagnose(Sema &S,
 
     case OR_Success:
       llvm_unreachable("Conversion did not fail!");
-      break;
     }
     break;
 
@@ -5541,9 +5538,7 @@ bool InitializationSequence::Diagnose(Sema &S,
 
       case OR_Success:
         llvm_unreachable("Conversion did not fail!");
-        break;
     }
-    break;
   }
 
   case FK_DefaultInitOfConst:
index 8281597e29e08868b0e10f87c7fe40fa939133f5..d14bf904df04ec3367e03302479c9a975814848a 100644 (file)
@@ -2762,7 +2762,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
       User.After.setFromType(ThisType->getAs<PointerType>()->getPointeeType());
       User.After.setAllToTypes(ToType);
       return OR_Success;
-    } else if (CXXConversionDecl *Conversion
+    }
+    if (CXXConversionDecl *Conversion
                  = dyn_cast<CXXConversionDecl>(Best->Function)) {
       S.MarkDeclarationReferenced(From->getLocStart(), Conversion);
 
@@ -2789,10 +2790,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
       //   13.3.3.1).
       User.After = Best->FinalConversion;
       return OR_Success;
-    } else {
-      llvm_unreachable("Not a constructor or conversion function?");
-      return OR_No_Viable_Function;
     }
+    llvm_unreachable("Not a constructor or conversion function?");
 
   case OR_No_Viable_Function:
     return OR_No_Viable_Function;
@@ -2804,7 +2803,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
     return OR_Ambiguous;
   }
 
-  return OR_No_Viable_Function;
+  llvm_unreachable("Invalid OverloadResult!");
 }
 
 bool
@@ -2852,7 +2851,7 @@ CompareImplicitConversionSequences(Sema &S,
   //   from any other user-defined conversion sequence.
   if (ICS1.getKindRank() < ICS2.getKindRank())
     return ImplicitConversionSequence::Better;
-  else if (ICS2.getKindRank() < ICS1.getKindRank())
+  if (ICS2.getKindRank() < ICS1.getKindRank())
     return ImplicitConversionSequence::Worse;
 
   // The following checks require both conversion sequences to be of
@@ -3664,7 +3663,7 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
     return false;
   }
 
-  return false;
+  llvm_unreachable("Invalid OverloadResult!");
 }
 
 /// \brief Compute an implicit conversion sequence for reference
@@ -8993,7 +8992,6 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
       return BuildResolvedCallExpr(Fn, FDecl, LParenLoc, Args, NumArgs,
                                    RParenLoc, ExecConfig);
     }
-    break;
   }
 
   // Overload resolution failed.
@@ -10422,7 +10420,6 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
   }
 
   llvm_unreachable("Invalid reference to overloaded function");
-  return E;
 }
 
 ExprResult Sema::FixOverloadedFunctionReference(ExprResult E,
index 35022be1a381e8eecd5c960cad88a993146019d7..f58e965934d4b8792c393f7f62ff6382045cdb8b 100644 (file)
@@ -502,7 +502,6 @@ static TemplateArgumentLoc translateTemplateArgument(Sema &SemaRef,
   }
 
   llvm_unreachable("Unhandled parsed template argument");
-  return TemplateArgumentLoc();
 }
 
 /// \brief Translates template arguments as provided by the parser
@@ -1139,7 +1138,7 @@ static bool DiagnoseDefaultTemplateArgument(Sema &S,
     // declaration (and it is a definition). Strange!
   }
 
-  return false;
+  llvm_unreachable("Invalid TemplateParamListContext!");
 }
 
 /// \brief Check for unexpanded parameter packs within the template parameters
@@ -2789,7 +2788,6 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
 
     case TemplateArgument::Pack:
       llvm_unreachable("Caller must expand template argument packs");
-      break;
     }
 
     return false;
@@ -2839,17 +2837,12 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
     return true;
 
   case TemplateArgument::Declaration:
-    llvm_unreachable(
-                       "Declaration argument with template template parameter");
-    break;
+    llvm_unreachable("Declaration argument with template template parameter");
   case TemplateArgument::Integral:
-    llvm_unreachable(
-                          "Integral argument with template template parameter");
-    break;
+    llvm_unreachable("Integral argument with template template parameter");
 
   case TemplateArgument::Pack:
     llvm_unreachable("Caller must expand template argument packs");
-    break;
   }
 
   return false;
@@ -3306,7 +3299,7 @@ bool UnnamedLocalNoLinkageFinder::VisitNestedNameSpecifier(
   case NestedNameSpecifier::TypeSpecWithTemplate:
     return Visit(QualType(NNS->getAsType(), 0));
   }
-  return false;
+  llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
 }
 
 
@@ -5324,7 +5317,6 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
 
       return true;
     }
-    break;
 
   case TSK_ExplicitInstantiationDeclaration:
     switch (PrevTSK) {
@@ -5364,7 +5356,6 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
       HasNoEffect = true;
       return false;
     }
-    break;
 
   case TSK_ExplicitInstantiationDefinition:
     switch (PrevTSK) {
@@ -5424,7 +5415,6 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
       HasNoEffect = true;
       return false;
     }
-    break;
   }
 
   llvm_unreachable("Missing specialization/instantiation case?");
index 03376fae9284f5d44db68a4d8712255698bfa555..a41878fcc1cede6c73df2d2f7de52bd8490e5134 100644 (file)
@@ -163,8 +163,8 @@ bool Sema::ActiveTemplateInstantiation::isInstantiationRecord() const {
   case DefaultTemplateArgumentChecking:
     return false;
   }
-  
-  return true;
+
+  llvm_unreachable("Invalid InstantiationKind!");
 }
 
 Sema::InstantiatingTemplate::
index 7fc5a1d777842e147ac9d48400f3b28d3a2656ca..ab6a2512e304e8435f6d660f1fee9417fd2f2864 100644 (file)
@@ -1398,10 +1398,8 @@ void ASTReader::ReadMacroRecord(ModuleFile &F, uint64_t Offset) {
       Macro->AddTokenToBody(Tok);
       break;
     }
+    }
   }
-  }
-  
-  return;
 }
 
 PreprocessedEntityID 
@@ -3275,8 +3273,6 @@ ASTReader::ASTReadResult ASTReader::ReadSubmoduleBlock(ModuleFile &F) {
     }
     }
   }
-
-  return Success;
 }
 
 /// \brief Parse the record that corresponds to a LangOptions data
@@ -3413,9 +3409,8 @@ PreprocessedEntity *ASTReader::ReadPreprocessedEntity(unsigned Index) {
     return ID;
   }
   }
-  
-  Error("invalid offset in preprocessor detail block");
-  return 0;
+
+  llvm_unreachable("Invalid PreprocessorDetailRecordTypes");
 }
 
 /// \brief \arg SLocMapI points at a chunk of a module that contains no
@@ -4101,8 +4096,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) {
     return Context.getAtomicType(ValueType);
   }
   }
-  // Suppress a GCC warning
-  return QualType();
+  llvm_unreachable("Invalid TypeCode!");
 }
 
 class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> {
@@ -4483,7 +4477,6 @@ ASTReader::GetTemplateArgumentLocInfo(ModuleFile &F,
     return TemplateArgumentLocInfo();
   }
   llvm_unreachable("unexpected template argument loc");
-  return TemplateArgumentLocInfo();
 }
 
 TemplateArgumentLoc
@@ -4600,15 +4593,12 @@ Decl *ASTReader::GetDecl(DeclID ID) {
     case PREDEF_DECL_OBJC_INSTANCETYPE_ID:
       return Context.getObjCInstanceTypeDecl();
     }
-    
-    return 0;
   }
   
   unsigned Index = ID - NUM_PREDEF_DECL_IDS;
 
   if (Index >= DeclsLoaded.size()) {
     Error("declaration ID out-of-range for AST file");
-    return 0;
   }
   
   if (!DeclsLoaded[Index]) {
@@ -5636,8 +5626,7 @@ ASTReader::ReadDeclarationName(ModuleFile &F,
     return DeclarationName::getUsingDirectiveName();
   }
 
-  // Required to silence GCC warning
-  return DeclarationName();
+  llvm_unreachable("Invalid NameKind!");
 }
 
 void ASTReader::ReadDeclarationNameLoc(ModuleFile &F,
index bdb7cd54a1313f54e94a908fd29d32c9dfe3b9d9..a7dfa1b19fea3d885ab712f151c9624a7166940e 100644 (file)
@@ -1447,7 +1447,6 @@ Stmt *ASTReader::ReadStmt(ModuleFile &F) {
   }
 
   llvm_unreachable("ReadingKind not set ?");
-  return 0;
 }
 
 Expr *ASTReader::ReadExpr(ModuleFile &F) {
@@ -1812,7 +1811,6 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
       break;
     case EXPR_OBJC_KVC_REF_EXPR:
       llvm_unreachable("mismatching AST file");
-      break;
     case EXPR_OBJC_MESSAGE_EXPR:
       S = ObjCMessageExpr::CreateEmpty(Context,
                                      Record[ASTStmtReader::NumExprFields],
index 59d0495d0abae9c220170584e3c6436c88a2a344..2f2f9d1f0bacdc965d9b04e34f668a68ca0eb5eb 100644 (file)
@@ -2732,7 +2732,7 @@ void RetainCountChecker::checkSummary(const RetainSummary &Summ,
 
   switch (RE.getKind()) {
     default:
-      llvm_unreachable("Unhandled RetEffect."); break;
+      llvm_unreachable("Unhandled RetEffect.");
 
     case RetEffect::NoRet:
       // No work necessary.
@@ -2833,7 +2833,6 @@ RetainCountChecker::updateSymbol(const ProgramState *state, SymbolRef sym,
     case IncRefMsg:
     case MakeCollectable:
       llvm_unreachable("DecRefMsg/IncRefMsg/MakeCollectable already converted");
-      return state;
 
     case Dealloc:
       // Any use of -dealloc in GC is *bad*.
@@ -2846,7 +2845,6 @@ RetainCountChecker::updateSymbol(const ProgramState *state, SymbolRef sym,
       switch (V.getKind()) {
         default:
           llvm_unreachable("Invalid RefVal state for an explicit dealloc.");
-          break;
         case RefVal::Owned:
           // The object immediately transitions to the released state.
           V = V ^ RefVal::Released;
@@ -2890,7 +2888,6 @@ RetainCountChecker::updateSymbol(const ProgramState *state, SymbolRef sym,
       switch (V.getKind()) {
         default:
           llvm_unreachable("Invalid RefVal state for a retain.");
-          break;
         case RefVal::Owned:
         case RefVal::NotOwned:
           V = V + 1;
@@ -2912,7 +2909,6 @@ RetainCountChecker::updateSymbol(const ProgramState *state, SymbolRef sym,
         default:
           // case 'RefVal::Released' handled above.
           llvm_unreachable("Invalid RefVal state for a release.");
-          break;
 
         case RefVal::Owned:
           assert(V.getCount() > 0);
@@ -2956,7 +2952,6 @@ void RetainCountChecker::processNonLeakError(const ProgramState *St,
   switch (ErrorKind) {
     default:
       llvm_unreachable("Unhandled error.");
-      return;
     case RefVal::ErrorUseAfterRelease:
       if (!useAfterRelease)
         useAfterRelease.reset(new UseAfterRelease());
index 280a48c101679518d32a3e219f668d7818e6ac1b..db84ccdce6cbe00c8007265c32b9f9e98dac9341 100644 (file)
@@ -181,7 +181,7 @@ bool CursorVisitor::Visit(CXCursor Cursor, bool CheckedRegionOfInterest) {
     return VisitChildren(Cursor);
   }
 
-  return false;
+  llvm_unreachable("Invalid CXChildVisitResult!");
 }
 
 static bool visitPreprocessedEntitiesInRange(SourceRange R,
@@ -573,7 +573,6 @@ bool CursorVisitor::VisitDeclContext(DeclContext *DC) {
 
 bool CursorVisitor::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
   llvm_unreachable("Translation units are visited directly by Visit()");
-  return false;
 }
 
 bool CursorVisitor::VisitTypeAliasDecl(TypeAliasDecl *D) {
@@ -1134,8 +1133,8 @@ bool CursorVisitor::VisitDeclarationNameInfo(DeclarationNameInfo Name) {
     // FIXME: Per-identifier location info?
     return false;
   }
-  
-  return false;
+
+  llvm_unreachable("Invalid DeclarationName::Kind!");
 }
 
 bool CursorVisitor::VisitNestedNameSpecifier(NestedNameSpecifier *NNS, 
@@ -1273,8 +1272,8 @@ bool CursorVisitor::VisitTemplateName(TemplateName Name, SourceLocation Loc) {
                   Name.getAsSubstTemplateTemplateParmPack()->getParameterPack(),
                                        Loc, TU));
   }
-                 
-  return false;
+
+  llvm_unreachable("Invalid TemplateName::Kind!");
 }
 
 bool CursorVisitor::VisitTemplateArgumentLoc(const TemplateArgumentLoc &TAL) {
@@ -1307,8 +1306,8 @@ bool CursorVisitor::VisitTemplateArgumentLoc(const TemplateArgumentLoc &TAL) {
     return VisitTemplateName(TAL.getArgument().getAsTemplateOrTemplatePattern(), 
                              TAL.getTemplateNameLoc());
   }
-  
-  return false;
+
+  llvm_unreachable("Invalid TemplateArgument::Kind!");
 }
 
 bool CursorVisitor::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
@@ -3385,7 +3384,6 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
   }
 
   llvm_unreachable("Unhandled CXCursorKind");
-  return createCXString((const char*) 0);
 }
 
 struct GetCursorData {
@@ -3962,11 +3960,8 @@ CXCursor clang_getCursorReferenced(CXCursor C) {
     default:
       // We would prefer to enumerate all non-reference cursor kinds here.
       llvm_unreachable("Unhandled reference cursor kind");
-      break;
     }
   }
-
-  return clang_getNullCursor();
 }
 
 CXCursor clang_getCursorDefinition(CXCursor C) {
index fb0ccb146f7dcee0a4b7b6bcd9c0d0fa25b72ca7..240b0f6c1fe1f1efe061641dd8b78d04ec582749 100644 (file)
@@ -46,9 +46,8 @@ enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor C) {
     case AS_private: return CX_CXXPrivate;
     case AS_none: return CX_CXXInvalidAccessSpecifier;
   }
-  
-  // FIXME: Clang currently thinks this is reachable.
-  return CX_CXXInvalidAccessSpecifier;
+
+  llvm_unreachable("Invalid AccessSpecifier!");
 }
 
 enum CXCursorKind clang_getTemplateCursorKind(CXCursor C) {
index c19b3404920f6d9ae8a843eee5631a0b8cc5ba90..d8ac4cf3e6c55dcbe3f749ac5d9a44b404f05e3c 100644 (file)
@@ -104,8 +104,7 @@ clang_getCompletionChunkKind(CXCompletionString completion_string,
     return CXCompletionChunk_VerticalSpace;
   }
 
-  // Should be unreachable, but let's be careful.
-  return CXCompletionChunk_Text;
+  llvm_unreachable("Invalid CompletionKind!");
 }
 
 CXString clang_getCompletionChunkText(CXCompletionString completion_string,
@@ -182,8 +181,7 @@ clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
     return (*CCStr)[chunk_number].Optional;
   }
 
-  // Should be unreachable, but let's be careful.
-  return 0;
+  llvm_unreachable("Invalid CompletionKind!");
 }
 
 unsigned clang_getNumCompletionChunks(CXCompletionString completion_string) {
index 1c2ffbfeb824ca3a5b9882027d80f6994fe72aee..446baa08fa99bf08eeb6c98b8fe4e5a82beda786 100644 (file)
@@ -395,7 +395,7 @@ void USRGenerator::VisitTagDecl(TagDecl *D) {
       case TTK_Struct: Out << "@ST"; break;
       case TTK_Class:  Out << "@CT"; break;
       case TTK_Union:  Out << "@UT"; break;
-      case TTK_Enum: llvm_unreachable("enum template"); break;
+      case TTK_Enum: llvm_unreachable("enum template");
       }
       VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
     } else if (ClassTemplatePartialSpecializationDecl *PartialSpec
@@ -406,7 +406,7 @@ void USRGenerator::VisitTagDecl(TagDecl *D) {
       case TTK_Struct: Out << "@SP"; break;
       case TTK_Class:  Out << "@CP"; break;
       case TTK_Union:  Out << "@UP"; break;
-      case TTK_Enum: llvm_unreachable("enum partial specialization"); break;
+      case TTK_Enum: llvm_unreachable("enum partial specialization");
       }      
       VisitTemplateParameterList(PartialSpec->getTemplateParameters());
     }
index b95515e6e2256957b337f35c393342e5bc124765..09049e8a0ec2a1903d0310796b878bd6b5857fd8 100644 (file)
@@ -84,7 +84,6 @@ CXDiagnosticSeverity CXLoadedDiagnostic::getSeverity() const {
   }
   
   llvm_unreachable("Invalid diagnostic level");
-  return CXDiagnostic_Ignored;
 }
 
 static CXSourceLocation makeLocation(const CXLoadedDiagnostic::Location *DLoc) {
@@ -297,7 +296,6 @@ CXDiagnosticSet DiagLoader::load(const char *file) {
         return 0;
       case Read_Record:
         llvm_unreachable("Top-level does not have records");
-        return 0;
       case Read_BlockEnd:
         continue;
       case Read_BlockBegin:
@@ -555,7 +553,6 @@ LoadResult DiagLoader::readDiagnosticBlock(llvm::BitstreamCursor &Stream,
     switch (Res) {
       case Read_EndOfStream:
         llvm_unreachable("EndOfStream handled in readToNextRecordOrBlock");
-        return Failure;
       case Read_Failure:
         return Failure;
       case Read_BlockBegin: {
index fb5d33d58472f00d09b8ee7d3998ffe73e4507b4..c1bcd74387a776852d46d24407b028aa10cce4fd 100644 (file)
@@ -38,7 +38,6 @@ CXDiagnosticSeverity CXStoredDiagnostic::getSeverity() const {
   }
   
   llvm_unreachable("Invalid diagnostic level");
-  return CXDiagnostic_Ignored;
 }
 
 CXSourceLocation CXStoredDiagnostic::getLocation() const {
index 5d6dee6b442f12cfacb5392f7a731b11fae4d9b7..e6f2e53aa70685fe55388681964dfaa6c7693be8 100644 (file)
@@ -28,6 +28,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <string>
 
 using namespace llvm;
@@ -56,7 +57,6 @@ static void ParseTypes(Record *r, std::string &s,
       default:
         throw TGError(r->getLoc(),
                       "Unexpected letter: " + std::string(data + len, 1));
-        break;
     }
     TV.push_back(StringRef(data, len + 1));
     data += len + 1;
@@ -78,7 +78,6 @@ static char Widen(const char t) {
       return 'f';
     default: throw "unhandled type in widen!";
   }
-  return '\0';
 }
 
 /// Narrow - Convert a type code into the next smaller type.  short -> char,
@@ -95,7 +94,6 @@ static char Narrow(const char t) {
       return 'h';
     default: throw "unhandled type in narrow!";
   }
-  return '\0';
 }
 
 /// For a particular StringRef, return the base type code, and whether it has
@@ -266,7 +264,6 @@ static std::string TypeString(const char mod, StringRef typestr) {
       break;
     default:
       throw "unhandled type!";
-      break;
   }
 
   if (mod == '2')
@@ -449,7 +446,6 @@ static std::string MangleName(const std::string &name, StringRef typestr,
     break;
   default:
     throw "unhandled type!";
-    break;
   }
   if (ck == ClassB)
     s += "_v";
@@ -588,7 +584,6 @@ static unsigned GetNumElements(StringRef typestr, bool &quad) {
   case 'f': nElts = 2; break;
   default:
     throw "unhandled type!";
-    break;
   }
   if (quad) nElts <<= 1;
   return nElts;
@@ -820,7 +815,6 @@ static std::string GenOpString(OpKind op, const std::string &proto,
   }
   default:
     throw "unknown OpKind!";
-    break;
   }
   return s;
 }
@@ -866,7 +860,6 @@ static unsigned GetNeonEnum(const std::string &proto, StringRef typestr) {
       break;
     default:
       throw "unhandled type!";
-      break;
   }
   NeonTypeFlags Flags(ET, usgn, quad && proto[1] != 'g');
   return Flags.getFlags();
@@ -1239,10 +1232,7 @@ static unsigned RangeFromType(const char mod, StringRef typestr) {
       return (1 << (int)quad) - 1;
     default:
       throw "unhandled type!";
-      break;
   }
-  assert(0 && "unreachable");
-  return 0;
 }
 
 /// runHeader - Emit a file with sections defining: