diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-01-17 06:56:22 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-01-17 06:56:22 +0000 |
commit | 7530c034c0c71a64c5a9173206d9742ae847af8b (patch) | |
tree | 761f6552c7bbb066813ae21d135bd02e550090aa /lib/Sema | |
parent | 561d3abc881033776ece385a01a510e1cbc1fa92 (diff) |
Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/CodeCompleteConsumer.cpp | 9 | ||||
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/SemaAccess.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaCXXScopeSpec.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/SemaCast.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 19 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaExceptionSpec.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 24 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaExprMember.cpp | 1 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 13 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 15 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 18 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 4 |
16 files changed, 47 insertions, 92 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index 80496c5c44..f1a6392769 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -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!"); } //===----------------------------------------------------------------------===// diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 2b5efc692f..11818f6fa2 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -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 diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp index e1322ed8a2..6014b9b47f 100644 --- a/lib/Sema/SemaAccess.cpp +++ b/lib/Sema/SemaAccess.cpp @@ -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) { diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index 31e33dda08..1ad50434db 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -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 diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index fe7667e93b..2420424bf2 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -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; diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index af0eedd791..e94aa2ffce 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -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) { diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index c280ac2990..730dde8c9e 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -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 diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 43bdf3f930..ea736320f8 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -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: diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index 92af2d914b..eb7be5d728 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -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; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 741ca9edd0..26ca3a9cc0 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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) { diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 6476f4a512..fceb639807 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -4786,8 +4786,8 @@ Sema::CheckMicrosoftIfExistsSymbol(Scope *S, case LookupResult::NotFoundInCurrentInstantiation: return IER_Dependent; } - - return IER_DoesNotExist; + + llvm_unreachable("Invalid LookupResult Kind!"); } Sema::IfExistsResult diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp index 0080156376..fb0fc34cf7 100644 --- a/lib/Sema/SemaExprMember.cpp +++ b/lib/Sema/SemaExprMember.cpp @@ -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. diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index cd8505932b..8a4f683049 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -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: diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 8281597e29..d14bf904df 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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, diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 35022be1a3..f58e965934 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -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?"); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 03376fae92..a41878fcc1 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -163,8 +163,8 @@ bool Sema::ActiveTemplateInstantiation::isInstantiationRecord() const { case DefaultTemplateArgumentChecking: return false; } - - return true; + + llvm_unreachable("Invalid InstantiationKind!"); } Sema::InstantiatingTemplate:: |