diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/IdentifierResolver.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaAttr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaCXXScopeSpec.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 12 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExceptionSpec.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 14 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 13 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 6 |
21 files changed, 62 insertions, 60 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index fad1199613..7e2f4ad281 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -650,7 +650,7 @@ bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, TypeQualifiers |= T; switch (T) { - default: assert(0 && "Unknown type qualifier!"); + default: llvm_unreachable("Unknown type qualifier!"); case TQ_const: TQ_constLoc = Loc; break; case TQ_restrict: TQ_restrictLoc = Loc; break; case TQ_volatile: TQ_volatileLoc = Loc; break; @@ -948,7 +948,7 @@ bool VirtSpecifiers::SetSpecifier(Specifier VS, SourceLocation Loc, Specifiers |= VS; switch (VS) { - default: assert(0 && "Unknown specifier!"); + default: llvm_unreachable("Unknown specifier!"); case VS_Override: VS_overrideLoc = Loc; break; case VS_Final: VS_finalLoc = Loc; break; } @@ -958,7 +958,7 @@ bool VirtSpecifiers::SetSpecifier(Specifier VS, SourceLocation Loc, const char *VirtSpecifiers::getSpecifierName(Specifier VS) { switch (VS) { - default: assert(0 && "Unknown specifier"); + default: llvm_unreachable("Unknown specifier"); case VS_Override: return "override"; case VS_Final: return "final"; } diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 95420a316a..a643267085 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/lib/Sema/IdentifierResolver.cpp @@ -73,7 +73,7 @@ void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) { } } - assert(0 && "Didn't find this decl on its identifier's chain!"); + llvm_unreachable("Didn't find this decl on its identifier's chain!"); } bool diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index 1c498925b7..cd03069ec8 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -265,7 +265,7 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, break; default: - assert(0 && "Invalid #pragma pack kind."); + llvm_unreachable("Invalid #pragma pack kind."); } } diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index a2cef9cf93..90fd7cdc40 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -137,7 +137,7 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS, switch (NNS->getKind()) { case NestedNameSpecifier::Identifier: - assert(false && "Dependent nested-name-specifier has no DeclContext"); + llvm_unreachable("Dependent nested-name-specifier has no DeclContext"); break; case NestedNameSpecifier::Namespace: diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index cda4d92d2f..052ef3bef2 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -548,7 +548,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { unsigned BuiltinID = FDecl->getBuiltinID(); unsigned BuiltinIndex, NumFixed = 1; switch (BuiltinID) { - default: assert(0 && "Unknown overloaded atomic builtin!"); + default: llvm_unreachable("Unknown overloaded atomic builtin!"); case Builtin::BI__sync_fetch_and_add: BuiltinIndex = 0; break; case Builtin::BI__sync_fetch_and_sub: BuiltinIndex = 1; break; case Builtin::BI__sync_fetch_and_or: BuiltinIndex = 2; break; diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 5b44841428..166e165d69 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -3400,7 +3400,7 @@ void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) { break; default: - assert(false && "Unknown type specifier kind in CodeCompleteTag"); + llvm_unreachable("Unknown type specifier kind in CodeCompleteTag"); return; } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 0e817658ae..3878341ca7 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2935,7 +2935,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { } // switch (Name.getKind()) - assert(false && "Unknown name kind"); + llvm_unreachable("Unknown name kind"); return DeclarationNameInfo(); } @@ -4360,7 +4360,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, DeclarationName Name = NameInfo.getName(); FunctionDecl::StorageClass SC = SC_None; switch (D.getDeclSpec().getStorageClassSpec()) { - default: assert(0 && "Unknown storage class!"); + default: llvm_unreachable("Unknown storage class!"); case DeclSpec::SCS_auto: case DeclSpec::SCS_register: case DeclSpec::SCS_mutable: @@ -8372,7 +8372,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { } } - assert(0 && "found no user-declared constructors"); + llvm_unreachable("found no user-declared constructors"); return; } break; @@ -8458,7 +8458,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { case CXXDestructor: hasTrivial = &CXXRecordDecl::hasTrivialDestructor; break; default: - assert(0 && "unexpected special member"); return; + llvm_unreachable("unexpected special member"); return; } // Check for nontrivial bases (and recurse). @@ -8506,7 +8506,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { } } - assert(0 && "found no explanation for non-trivial member"); + llvm_unreachable("found no explanation for non-trivial member"); } /// TranslateIvarVisibility - Translate visibility from a token ID to an @@ -8514,7 +8514,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { static ObjCIvarDecl::AccessControl TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility) { switch (ivarVisibility) { - default: assert(0 && "Unknown visitibility kind"); + default: llvm_unreachable("Unknown visitibility kind"); case tok::objc_private: return ObjCIvarDecl::Private; case tok::objc_public: return ObjCIvarDecl::Public; case tok::objc_protected: return ObjCIvarDecl::Protected; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 48f2f9675a..34eb49888d 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3205,7 +3205,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, switch (Attr.getKind()) { default: - assert(0 && "invalid ownership attribute"); + llvm_unreachable("invalid ownership attribute"); return; case AttributeList::AT_ns_returns_autoreleased: D->addAttr(::new (S.Context) NSReturnsAutoreleasedAttr(Attr.getRange(), diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 616f798594..ef8719c48e 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -9977,7 +9977,7 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) { } case CXXInvalid: - assert(false && "Invalid special member."); + llvm_unreachable("Invalid special member."); break; } } else { diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 94de7992ba..5a1ce28193 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1664,7 +1664,7 @@ void Sema::ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl, DiagnoseUnimplementedProperties(S, IMPDecl, CDecl, InsMap); } } else - assert(false && "invalid ObjCContainerDecl type."); + llvm_unreachable("invalid ObjCContainerDecl type."); } /// ActOnForwardClassDeclaration - diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index 65bed3a205..aba7b34977 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -223,7 +223,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { break; default: - assert(false && "This spec type is compatible with none."); + llvm_unreachable("This spec type is compatible with none."); } OS.flush(); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 7106ab2d16..582f153299 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2390,7 +2390,7 @@ ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) { PredefinedExpr::IdentType IT; switch (Kind) { - default: assert(0 && "Unknown simple primary expr!"); + default: llvm_unreachable("Unknown simple primary expr!"); case tok::kw___func__: IT = PredefinedExpr::Func; break; // [C99 6.4.2.2] case tok::kw___FUNCTION__: IT = PredefinedExpr::Function; break; case tok::kw___PRETTY_FUNCTION__: IT = PredefinedExpr::PrettyFunction; break; @@ -2952,7 +2952,7 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input) { UnaryOperatorKind Opc; switch (Kind) { - default: assert(0 && "Unknown unary op!"); + default: llvm_unreachable("Unknown unary op!"); case tok::plusplus: Opc = UO_PostInc; break; case tok::minusminus: Opc = UO_PostDec; break; } @@ -6511,7 +6511,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, case BO_GE: resultComparison = ") >= 0"; break; case BO_EQ: resultComparison = ") == 0"; break; case BO_NE: resultComparison = ") != 0"; break; - default: assert(false && "Invalid comparison operator"); + default: llvm_unreachable("Invalid comparison operator"); } DiagRuntimeBehavior(Loc, 0, @@ -7593,7 +7593,7 @@ static QualType CheckAddressOfOperand(Sema &S, Expr *OrigOp, } } } else if (!isa<FunctionDecl>(dcl) && !isa<NonTypeTemplateParmDecl>(dcl)) - assert(0 && "Unknown/unexpected decl type"); + llvm_unreachable("Unknown/unexpected decl type"); } if (AddressOfError != AO_No_Error) { @@ -7669,7 +7669,7 @@ static inline BinaryOperatorKind ConvertTokenKindToBinaryOpcode( tok::TokenKind Kind) { BinaryOperatorKind Opc; switch (Kind) { - default: assert(0 && "Unknown binop!"); + default: llvm_unreachable("Unknown binop!"); case tok::periodstar: Opc = BO_PtrMemD; break; case tok::arrowstar: Opc = BO_PtrMemI; break; case tok::star: Opc = BO_Mul; break; @@ -7710,7 +7710,7 @@ static inline UnaryOperatorKind ConvertTokenKindToUnaryOpcode( tok::TokenKind Kind) { UnaryOperatorKind Opc; switch (Kind) { - default: assert(0 && "Unknown unary op!"); + default: llvm_unreachable("Unknown unary op!"); case tok::plusplus: Opc = UO_PreInc; break; case tok::minusminus: Opc = UO_PreDec; break; case tok::amp: Opc = UO_AddrOf; break; @@ -8941,7 +8941,7 @@ ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) { else if (pw == Context.getTargetInfo().getLongLongWidth()) Ty = Context.LongLongTy; else { - assert(0 && "I don't know size of pointer!"); + llvm_unreachable("I don't know size of pointer!"); Ty = Context.IntTy; } @@ -8990,7 +8990,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, bool MayHaveConvFixit = false; switch (ConvTy) { - default: assert(0 && "Unknown conversion type"); + default: llvm_unreachable("Unknown conversion type"); case Compatible: return false; case PointerToInt: DiagKind = diag::ext_typecheck_convert_pointer_int; diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 140fd9003d..3beb51c865 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1525,7 +1525,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, return true; } } - assert(false && "Unreachable, bad result from BestViableFunction"); + llvm_unreachable("Unreachable, bad result from BestViableFunction"); return true; } @@ -2068,7 +2068,7 @@ static ExprResult BuildCXXCastArgument(Sema &S, DeclAccessPair FoundDecl, Expr *From) { switch (Kind) { - default: assert(0 && "Unhandled cast kind!"); + default: llvm_unreachable("Unhandled cast kind!"); case CK_ConstructorConversion: { ASTOwningVector<Expr*> ConstructorArgs(S); @@ -2181,7 +2181,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, return ExprError(); case ImplicitConversionSequence::EllipsisConversion: - assert(false && "Cannot perform an ellipsis conversion"); + llvm_unreachable("Cannot perform an ellipsis conversion"); return Owned(From); case ImplicitConversionSequence::BadConversion: @@ -2284,7 +2284,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, break; default: - assert(false && "Improper first standard conversion"); + llvm_unreachable("Improper first standard conversion"); break; } @@ -2524,7 +2524,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, case ICK_Function_To_Pointer: case ICK_Qualification: case ICK_Num_Conversion_Kinds: - assert(false && "Improper second standard conversion"); + llvm_unreachable("Improper second standard conversion"); break; } @@ -2550,7 +2550,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, } default: - assert(false && "Improper third standard conversion"); + llvm_unreachable("Improper third standard conversion"); break; } @@ -3560,7 +3560,7 @@ static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS break; case OR_Deleted: - assert(false && "Conditional operator has only built-in overloads"); + llvm_unreachable("Conditional operator has only built-in overloads"); break; } return true; diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 43477b266d..f710380720 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -512,7 +512,7 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity, else if (T->isVectorType()) maxElements = T->getAs<VectorType>()->getNumElements(); else - assert(0 && "CheckImplicitInitList(): Illegal type"); + llvm_unreachable("CheckImplicitInitList(): Illegal type"); if (maxElements == 0) { SemaRef.Diag(ParentIList->getInit(Index)->getLocStart(), @@ -656,7 +656,7 @@ void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity, SubobjectIsDesignatorContext, Index, StructuredList, StructuredIndex); } else - assert(0 && "Aggregate that isn't a structure or array?!"); + llvm_unreachable("Aggregate that isn't a structure or array?!"); } else if (DeclType->isVoidType() || DeclType->isFunctionType()) { // This type is invalid, issue a diagnostic. ++Index; diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 806fd39fee..7f42fb7178 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -4657,7 +4657,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion, break; default: - assert(false && + llvm_unreachable( "Can only end up with a standard conversion sequence or failure"); } } @@ -5039,7 +5039,7 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty, buildObjCPtr = true; } else - assert(false && "type was not a pointer type!"); + llvm_unreachable("type was not a pointer type!"); } else PointeeTy = PointerTy->getPointeeType(); @@ -6333,7 +6333,7 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, switch (Op) { case OO_None: case NUM_OVERLOADED_OPERATORS: - assert(false && "Expected an overloaded operator"); + llvm_unreachable("Expected an overloaded operator"); break; case OO_New: @@ -6341,7 +6341,8 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, case OO_Array_New: case OO_Array_Delete: case OO_Call: - assert(false && "Special operators don't use AddBuiltinOperatorCandidates"); + llvm_unreachable( + "Special operators don't use AddBuiltinOperatorCandidates"); break; case OO_Comma: @@ -7310,7 +7311,7 @@ static unsigned RankDeductionFailure(const OverloadCandidate::DeductionFailureInfo &DFI) { switch ((Sema::TemplateDeductionResult)DFI.Result) { case Sema::TDK_Success: - assert(0 && "TDK_success while diagnosing bad deduction"); + llvm_unreachable("TDK_success while diagnosing bad deduction"); case Sema::TDK_Incomplete: return 1; @@ -8368,7 +8369,7 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, if (ULE->decls_begin() + 1 == ULE->decls_end() && (F = dyn_cast<FunctionDecl>(*ULE->decls_begin())) && F->getBuiltinID() && F->isImplicit()) - assert(0 && "performing ADL for builtin"); + llvm_unreachable("performing ADL for builtin"); // We don't perform ADL in C. assert(getLangOptions().CPlusPlus && "ADL enabled in C"); diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 274c74c7b6..c75e337fdb 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1387,7 +1387,7 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc, else { // Can't be a DependentSizedArrayType or an IncompleteArrayType since // UnqAT is not incomplete and Range is not type-dependent. - assert(0 && "Unexpected array type in for-range"); + llvm_unreachable("Unexpected array type in for-range"); return StmtError(); } diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 43fdcb6d4a..4f90a72ea2 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2323,7 +2323,8 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, return TNK_Dependent_template_name; case UnqualifiedId::IK_LiteralOperatorId: - assert(false && "We don't support these; Parse shouldn't have allowed propagation"); + llvm_unreachable( + "We don't support these; Parse shouldn't have allowed propagation"); default: break; @@ -2681,7 +2682,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, switch (Arg.getArgument().getKind()) { case TemplateArgument::Null: - assert(false && "Should never see a NULL template argument here"); + llvm_unreachable("Should never see a NULL template argument here"); return true; case TemplateArgument::Expression: { @@ -2804,7 +2805,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, switch (Arg.getArgument().getKind()) { case TemplateArgument::Null: - assert(false && "Should never see a NULL template argument here"); + llvm_unreachable("Should never see a NULL template argument here"); return true; case TemplateArgument::Template: @@ -5216,7 +5217,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, switch (NewTSK) { case TSK_Undeclared: case TSK_ImplicitInstantiation: - assert(false && "Don't check implicit instantiations here"); + llvm_unreachable("Don't check implicit instantiations here"); return false; case TSK_ExplicitSpecialization: @@ -5349,7 +5350,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, break; } - assert(false && "Missing specialization/instantiation case?"); + llvm_unreachable("Missing specialization/instantiation case?"); return false; } diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index add8e10831..283cc575ad 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1539,7 +1539,7 @@ DeduceTemplateArguments(Sema &S, switch (Param.getKind()) { case TemplateArgument::Null: - assert(false && "Null template argument in parameter list"); + llvm_unreachable("Null template argument in parameter list"); break; case TemplateArgument::Type: @@ -1830,7 +1830,7 @@ static bool isSameTemplateArg(ASTContext &Context, switch (X.getKind()) { case TemplateArgument::Null: - assert(false && "Comparing NULL template argument"); + llvm_unreachable("Comparing NULL template argument"); break; case TemplateArgument::Type: diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index ffd7955fdf..d4406240d0 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -96,7 +96,7 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, Decl * TemplateDeclInstantiator::VisitTranslationUnitDecl(TranslationUnitDecl *D) { - assert(false && "Translation units cannot be instantiated"); + llvm_unreachable("Translation units cannot be instantiated"); return D; } @@ -110,7 +110,7 @@ TemplateDeclInstantiator::VisitLabelDecl(LabelDecl *D) { Decl * TemplateDeclInstantiator::VisitNamespaceDecl(NamespaceDecl *D) { - assert(false && "Namespaces cannot be instantiated"); + llvm_unreachable("Namespaces cannot be instantiated"); return D; } @@ -701,7 +701,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { } Decl *TemplateDeclInstantiator::VisitEnumConstantDecl(EnumConstantDecl *D) { - assert(false && "EnumConstantDecls can only occur within EnumDecls."); + llvm_unreachable("EnumConstantDecls can only occur within EnumDecls."); return 0; } @@ -3308,7 +3308,7 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { // and removed the need for implicit instantiation. switch (Var->getMostRecentDeclaration()->getTemplateSpecializationKind()) { case TSK_Undeclared: - assert(false && "Cannot instantitiate an undeclared specialization."); + llvm_unreachable("Cannot instantitiate an undeclared specialization."); case TSK_ExplicitInstantiationDeclaration: case TSK_ExplicitSpecialization: continue; // No longer need to instantiate this type. diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 6b98ed8721..2b4a509f11 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1750,7 +1750,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, switch (D.getContext()) { case Declarator::KNRTypeListContext: - assert(0 && "K&R type lists aren't allowed in C++"); + llvm_unreachable("K&R type lists aren't allowed in C++"); break; case Declarator::ObjCPrototypeContext: case Declarator::PrototypeContext: @@ -1760,7 +1760,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static) break; switch (cast<TagDecl>(SemaRef.CurContext)->getTagKind()) { - case TTK_Enum: assert(0 && "unhandled tag kind"); break; + case TTK_Enum: llvm_unreachable("unhandled tag kind"); break; case TTK_Struct: Error = 1; /* Struct member */ break; case TTK_Union: Error = 2; /* Union member */ break; case TTK_Class: Error = 3; /* Class member */ break; @@ -1921,7 +1921,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, state.setCurrentChunkIndex(chunkIndex); DeclaratorChunk &DeclType = D.getTypeObject(chunkIndex); switch (DeclType.Kind) { - default: assert(0 && "Unknown decltype!"); + default: llvm_unreachable("Unknown decltype!"); case DeclaratorChunk::Paren: T = S.BuildParenType(T); break; @@ -3035,7 +3035,7 @@ ParsedType Sema::CreateParsedType(QualType T, TypeSourceInfo *TInfo) { void LocInfoType::getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const { - assert(false && "LocInfoType leaked into the type system; an opaque TypeTy*" + llvm_unreachable("LocInfoType leaked into the type system; an opaque TypeTy*" " was used directly instead of getting the QualType through" " GetTypeFromParser"); } diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 27376816ec..0c22c61b66 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1728,7 +1728,7 @@ public: SubExpr, RParenLoc); default: - assert(false && "Invalid C++ named cast"); + llvm_unreachable("Invalid C++ named cast"); break; } @@ -2681,7 +2681,7 @@ TreeTransform<Derived> } } - assert(0 && "Unknown name kind."); + llvm_unreachable("Unknown name kind."); return DeclarationNameInfo(); } @@ -8049,7 +8049,7 @@ TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) { template<typename Derived> ExprResult TreeTransform<Derived>::TransformAsTypeExpr(AsTypeExpr *E) { - assert(false && "Cannot transform asType expressions yet"); + llvm_unreachable("Cannot transform asType expressions yet"); return SemaRef.Owned(E); } |