virtual ~Attr();
void* operator new(size_t bytes) throw() {
- assert(0 && "Attrs cannot be allocated with regular 'new'.");
+ llvm_unreachable("Attrs cannot be allocated with regular 'new'.");
return 0;
}
void operator delete(void* data) throw() {
- assert(0 && "Attrs cannot be released with regular 'delete'.");
+ llvm_unreachable("Attrs cannot be released with regular 'delete'.");
}
public:
// FIXME: This should probably never be called, but it's here as
TemplateParmPosition()
: Depth(0), Position(0)
- { /* assert(0 && "Cannot create positionless template parameter"); */ }
+ { /* llvm_unreachable("Cannot create positionless template parameter"); */ }
TemplateParmPosition(unsigned D, unsigned P)
: Depth(D), Position(P)
public:
RetTy Visit(Decl *D) {
switch (D->getKind()) {
- default: assert(false && "Decl that isn't part of DeclNodes.inc!");
+ default: llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
#define DECL(DERIVED, BASE) \
case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl);
#define ABSTRACT_DECL(DECL)
// This is pretty lame.
virtual void mangleItaniumGuardVariable(const VarDecl *D,
raw_ostream &) {
- assert(0 && "Target does not support mangling guard variables");
+ llvm_unreachable("Target does not support mangling guard variables");
}
/// @}
};
case TSK_ExplicitSpecialization:
break;
default:
- assert(false && "Unknown specialization kind.");
+ llvm_unreachable("Unknown specialization kind.");
}
}
// Make vanilla 'new' and 'delete' illegal for Stmts.
protected:
void* operator new(size_t bytes) throw() {
- assert(0 && "Stmts cannot be allocated with regular 'new'.");
+ llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
return 0;
}
void operator delete(void* data) throw() {
- assert(0 && "Stmts cannot be released with regular 'delete'.");
+ llvm_unreachable("Stmts cannot be released with regular 'delete'.");
}
class StmtBitfields {
// below.
if (PTR(BinaryOperator) BinOp = dyn_cast<BinaryOperator>(S)) {
switch (BinOp->getOpcode()) {
- default: assert(0 && "Unknown binary operator!");
+ default: llvm_unreachable("Unknown binary operator!");
case BO_PtrMemD: DISPATCH(BinPtrMemD, BinaryOperator);
case BO_PtrMemI: DISPATCH(BinPtrMemI, BinaryOperator);
case BO_Mul: DISPATCH(BinMul, BinaryOperator);
}
} else if (PTR(UnaryOperator) UnOp = dyn_cast<UnaryOperator>(S)) {
switch (UnOp->getOpcode()) {
- default: assert(0 && "Unknown unary operator!");
+ default: llvm_unreachable("Unknown unary operator!");
case UO_PostInc: DISPATCH(UnaryPostInc, UnaryOperator);
case UO_PostDec: DISPATCH(UnaryPostDec, UnaryOperator);
case UO_PreInc: DISPATCH(UnaryPreInc, UnaryOperator);
// Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
switch (S->getStmtClass()) {
- default: assert(0 && "Unknown stmt kind!");
+ default: llvm_unreachable("Unknown stmt kind!");
#define ABSTRACT_STMT(STMT)
#define STMT(CLASS, PARENT) \
case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS);
friend class StmtIteratorBase;
void Profile(llvm::FoldingSetNodeID &ID) {
- assert(0 && "Cannot unique VariableArrayTypes.");
+ llvm_unreachable("Cannot unique VariableArrayTypes.");
}
};
RetTy Visit(const Type *T) {
// Top switch stmt: dispatch to VisitFooType for each FooType.
switch (T->getTypeClass()) {
- default: assert(0 && "Unknown type class!");
+ default: llvm_unreachable("Unknown type class!");
#define ABSTRACT_TYPE(CLASS, PARENT)
#define TYPE(CLASS, PARENT) case Type::CLASS: DISPATCH(CLASS##Type);
#include "clang/AST/TypeNodes.def"
DISPATCH_CASE(UsingDirective)
DISPATCH_CASE(Using)
default:
- assert(false && "Subtype of ScopedDecl not handled.");
+ llvm_unreachable("Subtype of ScopedDecl not handled.");
}
}
CONDVAR_CASE(WhileStmt)
#undef CONDVAR_CASE
default:
- assert(false && "Infeasible");
+ llvm_unreachable("Infeasible");
}
static_cast<ImplClass*>(this)->Visit(CondVar->getInit());
}
void destroy() {
switch (Kind) {
- default: assert(0 && "Unknown decl type!");
+ default: llvm_unreachable("Unknown decl type!");
case DeclaratorChunk::Function: return Fun.destroy();
case DeclaratorChunk::Pointer: return Ptr.destroy();
case DeclaratorChunk::BlockPointer: return Cls.destroy();
void APValue::print(raw_ostream &OS) const {
switch (getKind()) {
- default: assert(0 && "Unknown APValue kind!");
+ default: llvm_unreachable("Unknown APValue kind!");
case Uninitialized:
OS << "Uninitialized";
return;
static void WriteShortAPValueToStream(raw_ostream& Out,
const APValue& V) {
switch (V.getKind()) {
- default: assert(0 && "Unknown APValue kind!");
+ default: llvm_unreachable("Unknown APValue kind!");
case APValue::Uninitialized:
Out << "Uninitialized";
break;
const BuiltinType *BT = T->getAs<BuiltinType>();
assert(BT && "Not a floating point type!");
switch (BT->getKind()) {
- default: assert(0 && "Not a floating point type!");
+ default: llvm_unreachable("Not a floating point type!");
case BuiltinType::Float: return Target->getFloatFormat();
case BuiltinType::Double: return Target->getDoubleFormat();
case BuiltinType::LongDouble: return Target->getLongDoubleFormat();
case Type::Builtin:
switch (cast<BuiltinType>(T)->getKind()) {
- default: assert(0 && "Unknown builtin type!");
+ default: llvm_unreachable("Unknown builtin type!");
case BuiltinType::Void:
// GCC extension: alignof(void) = 8 bits.
Width = 0;
}
// Silence GCC warning
- assert(false && "Unhandled template argument kind");
+ llvm_unreachable("Unhandled template argument kind");
return TemplateArgument();
}
assert(T->getAs<BuiltinType>() && "getFloatingRank(): not a floating type");
switch (T->getAs<BuiltinType>()->getKind()) {
- default: assert(0 && "getFloatingRank(): not a floating type");
+ default: llvm_unreachable("getFloatingRank(): not a floating type");
case BuiltinType::Float: return FloatRank;
case BuiltinType::Double: return DoubleRank;
case BuiltinType::LongDouble: return LongDoubleRank;
FloatingRank EltRank = getFloatingRank(Size);
if (Domain->isComplexType()) {
switch (EltRank) {
- default: assert(0 && "getFloatingRank(): illegal value for rank");
+ default: llvm_unreachable("getFloatingRank(): illegal value for rank");
case FloatRank: return FloatComplexTy;
case DoubleRank: return DoubleComplexTy;
case LongDoubleRank: return LongDoubleComplexTy;
assert(Domain->isRealFloatingType() && "Unknown domain!");
switch (EltRank) {
- default: assert(0 && "getFloatingRank(): illegal value for rank");
+ default: llvm_unreachable("getFloatingRank(): illegal value for rank");
case FloatRank: return FloatTy;
case DoubleRank: return DoubleTy;
case LongDoubleRank: return LongDoubleTy;
T = getFromTargetType(Target->getChar32Type()).getTypePtr();
switch (cast<BuiltinType>(T)->getKind()) {
- default: assert(0 && "getIntegerRank(): not a built-in integer");
+ default: llvm_unreachable("getIntegerRank(): not a built-in integer");
case BuiltinType::Bool:
return 1 + (getIntWidth(BoolTy) << 3);
case BuiltinType::Char_S:
static char ObjCEncodingForPrimitiveKind(const ASTContext *C, QualType T) {
switch (T->getAs<BuiltinType>()->getKind()) {
- default: assert(0 && "Unhandled builtin type kind");
+ default: llvm_unreachable("Unhandled builtin type kind");
case BuiltinType::Void: return 'v';
case BuiltinType::Bool: return 'B';
case BuiltinType::Char_U:
return;
}
- assert(0 && "@encode for type not implemented!");
+ llvm_unreachable("@encode for type not implemented!");
}
void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
case TargetInfo::UnsignedLongLong: return UnsignedLongLongTy;
}
- assert(false && "Unhandled TargetInfo::IntType value");
+ llvm_unreachable("Unhandled TargetInfo::IntType value");
return CanQualType();
}
#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
- assert(false && "Non-canonical and dependent types shouldn't get here");
+ llvm_unreachable("Non-canonical and dependent types shouldn't get here");
return QualType();
case Type::LValueReference:
case Type::RValueReference:
case Type::MemberPointer:
- assert(false && "C++ should never be in mergeTypes");
+ llvm_unreachable("C++ should never be in mergeTypes");
return QualType();
case Type::ObjCInterface:
case Type::VariableArray:
case Type::FunctionProto:
case Type::ExtVector:
- assert(false && "Types are eliminated above");
+ llvm_unreachable("Types are eliminated above");
return QualType();
case Type::Pointer:
case BuiltinType::Int128:
return UnsignedInt128Ty;
default:
- assert(0 && "Unexpected signed integer type");
+ llvm_unreachable("Unexpected signed integer type");
return QualType();
}
}
// Read the base type.
switch (*Str++) {
- default: assert(0 && "Unknown builtin type letter!");
+ default: llvm_unreachable("Unknown builtin type letter!");
case 'v':
assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers used with 'v'!");
case CXXABI_Microsoft:
return createMicrosoftMangleContext(*this, getDiagnostics());
}
- assert(0 && "Unsupported ABI");
+ llvm_unreachable("Unsupported ABI");
return 0;
}
bool NeedQuotes = true;
switch (Kind) {
- default: assert(0 && "unknown ArgumentKind");
+ default: llvm_unreachable("unknown ArgumentKind");
case Diagnostic::ak_qualtype: {
assert(ModLen == 0 && ArgLen == 0 &&
"Invalid modifier for QualType argument");
To.setNamedTypeInfo(Importer.Import(FromTInfo));
return;
}
- assert(0 && "Unknown name kind.");
+ llvm_unreachable("Unknown name kind.");
}
}
<DependentFunctionTemplateSpecializationInfo*>())
return TK_DependentFunctionTemplateSpecialization;
- assert(false && "Did we miss a TemplateOrSpecialization type?");
+ llvm_unreachable("Did we miss a TemplateOrSpecialization type?");
return TK_NonTemplate;
}
MSInfo->getPointOfInstantiation().isInvalid())
MSInfo->setPointOfInstantiation(PointOfInstantiation);
} else
- assert(false && "Function cannot have a template specialization kind");
+ llvm_unreachable("Function cannot have a template specialization kind");
}
SourceLocation FunctionDecl::getPointOfInstantiation() const {
const char *Decl::getDeclKindName() const {
switch (DeclKind) {
- default: assert(0 && "Declaration not in DeclNodes.inc!");
+ default: llvm_unreachable("Declaration not in DeclNodes.inc!");
#define DECL(DERIVED, BASE) case DERIVED: return #DERIVED;
#define ABSTRACT_DECL(DECL)
#include "clang/AST/DeclNodes.inc"
const char *DeclContext::getDeclKindName() const {
switch (DeclKind) {
- default: assert(0 && "Declaration context not in DeclNodes.inc!");
+ default: llvm_unreachable("Declaration context not in DeclNodes.inc!");
#define DECL(DERIVED, BASE) case Decl::DERIVED: return #DERIVED;
#define ABSTRACT_DECL(DECL)
#include "clang/AST/DeclNodes.inc"
void Decl::add(Kind k) {
switch (k) {
- default: assert(0 && "Declaration not in DeclNodes.inc!");
+ default: llvm_unreachable("Declaration not in DeclNodes.inc!");
#define DECL(DERIVED, BASE) case DERIVED: ++n##DERIVED##s; break;
#define ABSTRACT_DECL(DECL)
#include "clang/AST/DeclNodes.inc"
if (DK >= first##NAME && DK <= last##NAME) \
return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
#include "clang/AST/DeclNodes.inc"
- assert(false && "a decl that inherits DeclContext isn't handled");
+ llvm_unreachable("a decl that inherits DeclContext isn't handled");
return 0;
}
}
if (DK >= first##NAME && DK <= last##NAME) \
return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
#include "clang/AST/DeclNodes.inc"
- assert(false && "a decl that inherits DeclContext isn't handled");
+ llvm_unreachable("a decl that inherits DeclContext isn't handled");
return 0;
}
}
case AS_private: data().HasPrivateFields = true; break;
case AS_protected: data().HasProtectedFields = true; break;
case AS_public: data().HasPublicFields = true; break;
- case AS_none: assert(0 && "Invalid access specifier");
+ case AS_none: llvm_unreachable("Invalid access specifier");
};
if ((data().HasPrivateFields + data().HasProtectedFields +
data().HasPublicFields) > 1)
return;
}
- assert(false && "Not a class template or member class specialization");
+ llvm_unreachable("Not a class template or member class specialization");
}
CXXDestructorDecl *CXXRecordDecl::getDestructor() const {
switch (AS) {
default:
case AS_none:
- assert(0 && "Invalid access specifier!");
+ llvm_unreachable("Invalid access specifier!");
return 0;
case AS_public:
return "public";
return IMD->getClassInterface();
assert(!isa<ObjCProtocolDecl>(getDeclContext()) && "It's a protocol method");
- assert(false && "unknown method context");
+ llvm_unreachable("unknown method context");
return 0;
}
default:
case ObjCCategoryImpl:
case ObjCProtocol:
- assert(0 && "invalid ivar container!");
+ llvm_unreachable("invalid ivar container!");
return 0;
// Ivars can only appear in class extension categories.
else if (const VectorType *VTy = BaseType->getAs<VectorType>())
BaseType = VTy->getElementType();
else
- assert(0 && "Unknown declarator!");
+ llvm_unreachable("Unknown declarator!");
}
return BaseType;
}
void DeclPrinter::Print(AccessSpecifier AS) {
switch(AS) {
- case AS_none: assert(0 && "No access specifier!"); break;
+ case AS_none: llvm_unreachable("No access specifier!"); break;
case AS_public: Out << "public"; break;
case AS_protected: Out << "protected"; break;
case AS_private: Out << "private"; break;
}
// Can't actually get here.
- assert(0 && "This should be unreachable!");
+ llvm_unreachable("This should be unreachable!");
return Identifier;
}
return;
}
- assert(false && "Unexpected declaration name kind");
+ llvm_unreachable("Unexpected declaration name kind");
}
QualType DeclarationName::getCXXNameType() const {
return getCXXLiteralIdentifier()->getFETokenInfo<void>();
default:
- assert(false && "Declaration name has no FETokenInfo");
+ llvm_unreachable("Declaration name has no FETokenInfo");
}
return 0;
}
break;
default:
- assert(false && "Declaration name has no FETokenInfo");
+ llvm_unreachable("Declaration name has no FETokenInfo");
}
}
Name.printName(OS);
return;
}
- assert(false && "Unexpected declaration name kind");
+ llvm_unreachable("Unexpected declaration name kind");
}
SourceLocation DeclarationNameInfo::getEndLoc() const {
case DeclarationName::CXXUsingDirective:
return NameLoc;
}
- assert(false && "Unexpected declaration name kind");
+ llvm_unreachable("Unexpected declaration name kind");
return SourceLocation();
}
/// corresponds to, e.g. "sizeof" or "[pre]++".
const char *UnaryOperator::getOpcodeStr(Opcode Op) {
switch (Op) {
- default: assert(0 && "Unknown unary operator");
+ default: llvm_unreachable("Unknown unary operator");
case UO_PostInc: return "++";
case UO_PostDec: return "--";
case UO_PreInc: return "++";
UnaryOperatorKind
UnaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix) {
switch (OO) {
- default: assert(false && "No unary operator for overloaded function");
+ default: llvm_unreachable("No unary operator for overloaded function");
case OO_PlusPlus: return Postfix ? UO_PostInc : UO_PreInc;
case OO_MinusMinus: return Postfix ? UO_PostDec : UO_PreDec;
case OO_Amp: return UO_AddrOf;
BinaryOperatorKind
BinaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO) {
switch (OO) {
- default: assert(false && "Not an overloadable binary operator");
+ default: llvm_unreachable("Not an overloadable binary operator");
case OO_Plus: return BO_Add;
case OO_Minus: return BO_Sub;
case OO_Star: return BO_Mul;
if (isValueDependent()) {
switch (NPC) {
case NPC_NeverValueDependent:
- assert(false && "Unexpected value dependent expression!");
+ llvm_unreachable("Unexpected value dependent expression!");
// If the unthinkable happens, fall through to the safest alternative.
case NPC_ValueDependentIsNull:
ExprEvaluatorBase(EvalInfo &Info) : Info(Info) {}
RetTy VisitStmt(const Stmt *) {
- assert(0 && "Expression evaluator should not be called on stmts");
+ llvm_unreachable("Expression evaluator should not be called on stmts");
return DerivedError(0);
}
RetTy VisitExpr(const Expr *E) {
else if (ArgTy->isUnionType())
return union_type_class;
else // FIXME: offset_type_class, method_type_class, & lang_type_class?
- assert(0 && "CallExpr::isBuiltinClassifyType(): unimplemented type");
+ llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
return -1;
}
switch (E->getOpcode()) {
default:
- assert(0 && "Invalid binary operator!");
+ llvm_unreachable("Invalid binary operator!");
case BO_LT:
return Success(CR == APFloat::cmpLessThan, E);
case BO_GT:
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
- assert(false && "Can't mangle Objective-C selector names here!");
+ llvm_unreachable("Can't mangle Objective-C selector names here!");
break;
case DeclarationName::CXXConstructorName:
break;
case DeclarationName::CXXUsingDirective:
- assert(false && "Can't mangle a using directive name!");
+ llvm_unreachable("Can't mangle a using directive name!");
break;
}
}
case OO_None:
case NUM_OVERLOADED_OPERATORS:
- assert(false && "Not an overloaded operator");
+ llvm_unreachable("Not an overloaded operator");
break;
}
}
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
- assert(false && "Can't mangle Objective-C selector names here!");
+ llvm_unreachable("Can't mangle Objective-C selector names here!");
break;
case DeclarationName::CXXConstructorName:
- assert(false && "Can't mangle constructors yet!");
+ llvm_unreachable("Can't mangle constructors yet!");
break;
case DeclarationName::CXXDestructorName:
- assert(false && "Can't mangle destructors yet!");
+ llvm_unreachable("Can't mangle destructors yet!");
break;
case DeclarationName::CXXConversionFunctionName:
case DeclarationName::CXXLiteralOperatorName:
// FIXME: Was this added in VS2010? Does MS even know how to mangle this?
- assert(false && "Don't know how to mangle literal operators yet!");
+ llvm_unreachable("Don't know how to mangle literal operators yet!");
break;
case DeclarationName::CXXUsingDirective:
- assert(false && "Can't mangle a using directive name!");
+ llvm_unreachable("Can't mangle a using directive name!");
break;
}
}
case OO_Array_Delete: Out << "?_V"; break;
case OO_Conditional:
- assert(false && "Don't know how to mangle ?:");
+ llvm_unreachable("Don't know how to mangle ?:");
break;
case OO_None:
case NUM_OVERLOADED_OPERATORS:
- assert(false && "Not an overloaded operator");
+ llvm_unreachable("Not an overloaded operator");
break;
}
}
case BuiltinType::Dependent:
case BuiltinType::UnknownAny:
case BuiltinType::BoundMember:
- assert(false &&
+ llvm_unreachable(
"Overloaded and dependent types shouldn't get to name mangling");
break;
case BuiltinType::ObjCId: Out << "PAUobjc_object@@"; break;
case BuiltinType::Char16:
case BuiltinType::Char32:
case BuiltinType::NullPtr:
- assert(false && "Don't know how to mangle this type");
+ llvm_unreachable("Don't know how to mangle this type");
break;
}
}
CC = IsInstMethod ? getASTContext().getDefaultMethodCallConv() : CC_C;
switch (CC) {
default:
- assert(0 && "Unsupported CC for mangling");
+ llvm_unreachable("Unsupported CC for mangling");
case CC_Default:
case CC_C: Out << 'A'; break;
case CC_X86Pascal: Out << 'C'; break;
}
void MicrosoftCXXNameMangler::mangleType(const UnresolvedUsingType *T) {
- assert(false && "Don't know how to mangle UnresolvedUsingTypes yet!");
+ llvm_unreachable("Don't know how to mangle UnresolvedUsingTypes yet!");
}
// <type> ::= <union-type> | <struct-type> | <class-type> | <enum-type>
Dimensions.push_back(CAT->getSize());
ElementTy = CAT->getElementType();
} else if (ElementTy->isVariableArrayType()) {
- assert(false && "Don't know how to mangle VLAs!");
+ llvm_unreachable("Don't know how to mangle VLAs!");
} else if (ElementTy->isDependentSizedArrayType()) {
// The dependent expression has to be folded into a constant (TODO).
- assert(false && "Don't know how to mangle dependent-sized arrays!");
+ llvm_unreachable("Don't know how to mangle dependent-sized arrays!");
} else if (ElementTy->isIncompleteArrayType()) continue;
else break;
}
}
void MicrosoftCXXNameMangler::mangleType(const TemplateTypeParmType *T) {
- assert(false && "Don't know how to mangle TemplateTypeParmTypes yet!");
+ llvm_unreachable("Don't know how to mangle TemplateTypeParmTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(
const SubstTemplateTypeParmPackType *T) {
- assert(false &&
+ llvm_unreachable(
"Don't know how to mangle SubstTemplateTypeParmPackTypes yet!");
}
}
void MicrosoftCXXNameMangler::mangleType(const RValueReferenceType *T) {
- assert(false && "Don't know how to mangle RValueReferenceTypes yet!");
+ llvm_unreachable("Don't know how to mangle RValueReferenceTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ComplexType *T) {
- assert(false && "Don't know how to mangle ComplexTypes yet!");
+ llvm_unreachable("Don't know how to mangle ComplexTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const VectorType *T) {
- assert(false && "Don't know how to mangle VectorTypes yet!");
+ llvm_unreachable("Don't know how to mangle VectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ExtVectorType *T) {
- assert(false && "Don't know how to mangle ExtVectorTypes yet!");
+ llvm_unreachable("Don't know how to mangle ExtVectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DependentSizedExtVectorType *T) {
- assert(false && "Don't know how to mangle DependentSizedExtVectorTypes yet!");
+ llvm_unreachable(
+ "Don't know how to mangle DependentSizedExtVectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T) {
}
void MicrosoftCXXNameMangler::mangleType(const InjectedClassNameType *T) {
- assert(false && "Don't know how to mangle InjectedClassNameTypes yet!");
+ llvm_unreachable("Don't know how to mangle InjectedClassNameTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TemplateSpecializationType *T) {
- assert(false && "Don't know how to mangle TemplateSpecializationTypes yet!");
+ llvm_unreachable("Don't know how to mangle TemplateSpecializationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DependentNameType *T) {
- assert(false && "Don't know how to mangle DependentNameTypes yet!");
+ llvm_unreachable("Don't know how to mangle DependentNameTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(
const DependentTemplateSpecializationType *T) {
- assert(false &&
+ llvm_unreachable(
"Don't know how to mangle DependentTemplateSpecializationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const PackExpansionType *T) {
- assert(false && "Don't know how to mangle PackExpansionTypes yet!");
+ llvm_unreachable("Don't know how to mangle PackExpansionTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TypeOfType *T) {
- assert(false && "Don't know how to mangle TypeOfTypes yet!");
+ llvm_unreachable("Don't know how to mangle TypeOfTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TypeOfExprType *T) {
- assert(false && "Don't know how to mangle TypeOfExprTypes yet!");
+ llvm_unreachable("Don't know how to mangle TypeOfExprTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DecltypeType *T) {
- assert(false && "Don't know how to mangle DecltypeTypes yet!");
+ llvm_unreachable("Don't know how to mangle DecltypeTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const UnaryTransformType *T) {
- assert(false && "Don't know how to mangle UnaryTransformationTypes yet!");
+ llvm_unreachable("Don't know how to mangle UnaryTransformationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const AutoType *T) {
- assert(false && "Don't know how to mangle AutoTypes yet!");
+ llvm_unreachable("Don't know how to mangle AutoTypes yet!");
}
void MicrosoftMangleContext::mangleName(const NamedDecl *D,
void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD,
const ThunkInfo &Thunk,
raw_ostream &) {
- assert(false && "Can't yet mangle thunks!");
+ llvm_unreachable("Can't yet mangle thunks!");
}
void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD,
CXXDtorType Type,
const ThisAdjustment &,
raw_ostream &) {
- assert(false && "Can't yet mangle destructor thunks!");
+ llvm_unreachable("Can't yet mangle destructor thunks!");
}
void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD,
raw_ostream &) {
- assert(false && "Can't yet mangle virtual tables!");
+ llvm_unreachable("Can't yet mangle virtual tables!");
}
void MicrosoftMangleContext::mangleCXXVTT(const CXXRecordDecl *RD,
raw_ostream &) {
}
void MicrosoftMangleContext::mangleCXXRTTI(QualType T,
raw_ostream &) {
- assert(false && "Can't yet mangle RTTI!");
+ llvm_unreachable("Can't yet mangle RTTI!");
}
void MicrosoftMangleContext::mangleCXXRTTIName(QualType T,
raw_ostream &) {
- assert(false && "Can't yet mangle RTTI names!");
+ llvm_unreachable("Can't yet mangle RTTI names!");
}
void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D,
CXXCtorType Type,
raw_ostream &) {
- assert(false && "Can't yet mangle constructors!");
+ llvm_unreachable("Can't yet mangle constructors!");
}
void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D,
CXXDtorType Type,
raw_ostream &) {
- assert(false && "Can't yet mangle destructors!");
+ llvm_unreachable("Can't yet mangle destructors!");
}
void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *,
raw_ostream &) {
- assert(false && "Can't yet mangle reference temporaries!");
+ llvm_unreachable("Can't yet mangle reference temporaries!");
}
MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context,
DumpSubTree(SAD->getMessage());
OS << ");\"";
} else {
- assert(0 && "Unexpected decl");
+ llvm_unreachable("Unexpected decl");
}
}
void StmtDumper::VisitPredefinedExpr(PredefinedExpr *Node) {
DumpExpr(Node);
switch (Node->getIdentType()) {
- default: assert(0 && "unknown case");
+ default: llvm_unreachable("unknown case");
case PredefinedExpr::Func: OS << " __func__"; break;
case PredefinedExpr::Function: OS << " __FUNCTION__"; break;
case PredefinedExpr::PrettyFunction: OS << " __PRETTY_FUNCTION__";break;
void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
switch (Node->getIdentType()) {
default:
- assert(0 && "unknown case");
+ llvm_unreachable("unknown case");
case PredefinedExpr::Func:
OS << "__func__";
break;
// Emit suffixes. Integer literals are always a builtin integer type.
switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
- default: assert(0 && "Unexpected type for integer literal!");
+ default: llvm_unreachable("Unexpected type for integer literal!");
case BuiltinType::Int: break; // no suffix.
case BuiltinType::UInt: OS << 'U'; break;
case BuiltinType::Long: OS << 'L'; break;
OS << ' ' << OpStrings[Kind] << ' ';
PrintExpr(Node->getArg(1));
} else {
- assert(false && "unknown overloaded operator");
+ llvm_unreachable("unknown overloaded operator");
}
}
bool TemplateArgument::isDependent() const {
switch (getKind()) {
case Null:
- assert(false && "Should not have a NULL template argument");
+ llvm_unreachable("Should not have a NULL template argument");
return false;
case Type:
bool TemplateArgument::isInstantiationDependent() const {
switch (getKind()) {
case Null:
- assert(false && "Should not have a NULL template argument");
+ llvm_unreachable("Should not have a NULL template argument");
return false;
case Type:
OS << " && ...";
return;
default:
- assert(false && "Invalid logical operator.");
+ llvm_unreachable("Invalid logical operator.");
}
}
OS << ")";
} else
- assert(false && "Invalid label statement in CFGBlock.");
+ llvm_unreachable("Invalid label statement in CFGBlock.");
OS << ":\n";
}
bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
switch (K) {
case InvalidTy:
- assert(false && "ArgTypeResult must be valid");
+ llvm_unreachable("ArgTypeResult must be valid");
return true;
case UnknownTy:
QualType ArgTypeResult::getRepresentativeType(ASTContext &C) const {
switch (K) {
case InvalidTy:
- assert(false && "No representative type for Invalid ArgTypeResult");
+ llvm_unreachable("No representative type for Invalid ArgTypeResult");
// Fall-through.
case UnknownTy:
return QualType();
HasAlternativeForm = 0;
HasPlusPrefix = 0;
} else {
- assert(0 && "Unexpected type");
+ llvm_unreachable("Unexpected type");
}
return true;
bool ShouldEmitInSystemHeader = false;
switch (MappingInfo & 7) {
- default: assert(0 && "Unknown mapping!");
+ default: llvm_unreachable("Unknown mapping!");
case diag::MAP_IGNORE:
if (Diag.EnableAllWarnings) {
// Leave the warning disabled if it was explicitly ignored.
/// For example, SignedShort -> "short".
const char *TargetInfo::getTypeName(IntType T) {
switch (T) {
- default: assert(0 && "not an integer!");
+ default: llvm_unreachable("not an integer!");
case SignedShort: return "short";
case UnsignedShort: return "unsigned short";
case SignedInt: return "int";
/// integer type enum. For example, SignedLong -> "L".
const char *TargetInfo::getTypeConstantSuffix(IntType T) {
switch (T) {
- default: assert(0 && "not an integer!");
+ default: llvm_unreachable("not an integer!");
case SignedShort:
case SignedInt: return "";
case SignedLong: return "L";
/// enum. For example, SignedInt -> getIntWidth().
unsigned TargetInfo::getTypeWidth(IntType T) const {
switch (T) {
- default: assert(0 && "not an integer!");
+ default: llvm_unreachable("not an integer!");
case SignedShort:
case UnsignedShort: return getShortWidth();
case SignedInt:
/// enum. For example, SignedInt -> getIntAlign().
unsigned TargetInfo::getTypeAlign(IntType T) const {
switch (T) {
- default: assert(0 && "not an integer!");
+ default: llvm_unreachable("not an integer!");
case SignedShort:
case UnsignedShort: return getShortAlign();
case SignedInt:
/// the type is signed; false otherwise.
bool TargetInfo::isTypeSigned(IntType T) {
switch (T) {
- default: assert(0 && "not an integer!");
+ default: llvm_unreachable("not an integer!");
case SignedShort:
case SignedInt:
case SignedLong:
else if (ABI == "eabi")
Builder.defineMacro("__mips_eabi");
else
- assert(false && "Invalid ABI for Mips32.");
+ llvm_unreachable("Invalid ABI for Mips32.");
}
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const {
Builder.defineMacro("_MIPS_SIM", "_ABI64");
}
else
- assert(false && "Invalid ABI for Mips64.");
+ llvm_unreachable("Invalid ABI for Mips64.");
}
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const {
StringRef FnName;
switch (ValTyP->getKind()) {
- default: assert(0 && "Isn't a scalar fp type!");
+ default: llvm_unreachable("Isn't a scalar fp type!");
case BuiltinType::Float: FnName = "fabsf"; break;
case BuiltinType::Double: FnName = "fabs"; break;
case BuiltinType::LongDouble: FnName = "fabsl"; break;
Value *RHS = EmitScalarExpr(E->getArg(1));
switch (BuiltinID) {
- default: assert(0 && "Unknown ordered comparison");
+ default: llvm_unreachable("Unknown ordered comparison");
case Builtin::BI__builtin_isgreater:
LHS = Builder.CreateFCmpOGT(LHS, RHS, "cmp");
break;
case Builtin::BI__sync_lock_test_and_set:
case Builtin::BI__sync_lock_release:
case Builtin::BI__sync_swap:
- assert(0 && "Shouldn't make it through sema");
+ llvm_unreachable("Shouldn't make it through sema");
case Builtin::BI__sync_fetch_and_add_1:
case Builtin::BI__sync_fetch_and_add_2:
case Builtin::BI__sync_fetch_and_add_4:
case ARM::BI__builtin_neon_vld4_dup_v:
Int = Intrinsic::arm_neon_vld2;
break;
- default: assert(0 && "unknown vld_dup intrinsic?");
+ default: llvm_unreachable("unknown vld_dup intrinsic?");
}
Function *F = CGM.getIntrinsic(Int, Ty);
Value *Align = GetPointeeAlignment(*this, E->getArg(1));
case ARM::BI__builtin_neon_vld4_dup_v:
Int = Intrinsic::arm_neon_vld2lane;
break;
- default: assert(0 && "unknown vld_dup intrinsic?");
+ default: llvm_unreachable("unknown vld_dup intrinsic?");
}
Function *F = CGM.getIntrinsic(Int, Ty);
llvm::StructType *STy = cast<llvm::StructType>(F->getReturnType());
Intrinsic::ID ID = Intrinsic::not_intrinsic;
switch (BuiltinID) {
- default: assert(0 && "Unsupported shift intrinsic!");
+ default: llvm_unreachable("Unsupported shift intrinsic!");
case X86::BI__builtin_ia32_pslldi128:
name = "pslldi";
ID = Intrinsic::x86_sse2_psll_d;
Intrinsic::ID ID = Intrinsic::not_intrinsic;
switch (BuiltinID) {
- default: assert(0 && "Unsupported shift intrinsic!");
+ default: llvm_unreachable("Unsupported shift intrinsic!");
case X86::BI__builtin_ia32_pslldi:
name = "pslldi";
ID = Intrinsic::x86_mmx_psll_d;
Ops.pop_back();
switch (BuiltinID) {
- default: assert(0 && "Unsupported ld/lvsl/lvsr intrinsic!");
+ default: llvm_unreachable("Unsupported ld/lvsl/lvsr intrinsic!");
case PPC::BI__builtin_altivec_lvx:
ID = Intrinsic::ppc_altivec_lvx;
break;
Ops.pop_back();
switch (BuiltinID) {
- default: assert(0 && "Unsupported st intrinsic!");
+ default: llvm_unreachable("Unsupported st intrinsic!");
case PPC::BI__builtin_altivec_stvx:
ID = Intrinsic::ppc_altivec_stvx;
break;
break;
case ABIArgInfo::Expand:
- assert(0 && "Invalid ABI kind for return argument");
+ llvm_unreachable("Invalid ABI kind for return argument");
}
if (RetAttrs)
break;
case ABIArgInfo::Expand:
- assert(0 && "Invalid ABI kind for return argument");
+ llvm_unreachable("Invalid ABI kind for return argument");
}
llvm::Instruction *Ret = RV ? Builder.CreateRet(RV) : Builder.CreateRetVoid();
}
case ABIArgInfo::Expand:
- assert(0 && "Invalid ABI kind for return argument");
+ llvm_unreachable("Invalid ABI kind for return argument");
}
- assert(0 && "Unhandled ABIArgInfo::Kind");
+ llvm_unreachable("Unhandled ABIArgInfo::Kind");
return RValue::get(0);
}
const char *BTName = NULL;
switch (BT->getKind()) {
case BuiltinType::Dependent:
- assert(0 && "Unexpected builtin type Dependent");
+ llvm_unreachable("Unexpected builtin type Dependent");
return llvm::DIType();
case BuiltinType::Overload:
- assert(0 && "Unexpected builtin type Overload");
+ llvm_unreachable("Unexpected builtin type Overload");
return llvm::DIType();
case BuiltinType::BoundMember:
- assert(0 && "Unexpected builtin type BoundMember");
+ llvm_unreachable("Unexpected builtin type BoundMember");
return llvm::DIType();
case BuiltinType::UnknownAny:
- assert(0 && "Unexpected builtin type UnknownAny");
+ llvm_unreachable("Unexpected builtin type UnknownAny");
return llvm::DIType();
case BuiltinType::NullPtr:
return DBuilder.
#define NON_CANONICAL_TYPE(Class, Base)
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
- assert(false && "Dependent types cannot show up in debug information");
+ llvm_unreachable("Dependent types cannot show up in debug information");
case Type::ExtVector:
case Type::Vector:
case Decl::FriendTemplate:
case Decl::Block:
case Decl::ClassScopeFunctionSpecialization:
- assert(0 && "Declaration should not be in declstmts!");
+ llvm_unreachable("Declaration should not be in declstmts!");
case Decl::Function: // void X();
case Decl::Record: // struct/union/class X;
case Decl::Enum: // enum X;
return CGM.getOpenCLRuntime().EmitWorkGroupLocalVarDecl(*this, D);
}
- assert(0 && "Unknown storage class");
+ llvm_unreachable("Unknown storage class");
}
static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D,
ContextName = Name.getString();
}
else
- assert(0 && "Unknown context for block static var decl");
+ llvm_unreachable("Unknown context for block static var decl");
} else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) {
StringRef Name = CGM.getMangledName(FD);
ContextName = Name.str();
} else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl))
ContextName = CGF.CurFn->getName();
else
- assert(0 && "Unknown context for static var decl");
+ llvm_unreachable("Unknown context for static var decl");
return ContextName + Separator + D.getNameAsString();
}
else {
switch (ObjCARCReferenceLifetimeType.getObjCLifetime()) {
case Qualifiers::OCL_None:
- assert(0 && "Not a reference temporary that needs to be deallocated");
+ llvm_unreachable(
+ "Not a reference temporary that needs to be deallocated");
case Qualifiers::OCL_ExplicitNone:
case Qualifiers::OCL_Autoreleasing:
// Nothing to do.
Vec = Builder.CreateShuffleVector(Vec, ExtSrcVal, MaskV, "tmp");
} else {
// We should never shorten the vector
- assert(0 && "unexpected shorten vector length");
+ llvm_unreachable("unexpected shorten vector length");
}
} else {
// If the Src is a scalar (not a vector) it must be updating one element.
if (const FunctionDecl *fn = dyn_cast<FunctionDecl>(ND))
return EmitFunctionDeclLValue(*this, E, fn);
- assert(false && "Unhandled DeclRefExpr");
+ llvm_unreachable("Unhandled DeclRefExpr");
// an invalid LValue, but the assert will
// ensure that this point is never reached.
QualType ExprTy = getContext().getCanonicalType(E->getSubExpr()->getType());
switch (E->getOpcode()) {
- default: assert(0 && "Unknown unary operator lvalue!");
+ default: llvm_unreachable("Unknown unary operator lvalue!");
case UO_Deref: {
QualType T = E->getSubExpr()->getType()->getPointeeType();
assert(!T.isNull() && "CodeGenFunction::EmitUnaryOpLValue: Illegal type");
std::string GlobalVarName;
switch (Type) {
- default: assert(0 && "Invalid type");
+ default: llvm_unreachable("Invalid type");
case PredefinedExpr::Func:
GlobalVarName = "__func__.";
break;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND))
return EmitFunctionDeclLValue(*this, E, FD);
- assert(false && "Unhandled member declaration!");
+ llvm_unreachable("Unhandled member declaration!");
return LValue();
}
case CK_DerivedToBase:
case CK_BaseToDerived:
case CK_UncheckedDerivedToBase: {
- assert(0 && "cannot perform hierarchy conversion in EmitAggExpr: "
+ llvm_unreachable("cannot perform hierarchy conversion in EmitAggExpr: "
"should have been unpacked before we got here");
break;
}
ComplexPairTy VisitStmt(Stmt *S) {
S->dump(CGF.getContext().getSourceManager());
- assert(0 && "Stmt can't have complex result type!");
+ llvm_unreachable("Stmt can't have complex result type!");
return ComplexPairTy();
}
ComplexPairTy VisitExpr(Expr *S);
if (ILE->getType()->isVectorType())
return 0;
- assert(0 && "Unable to handle InitListExpr");
+ llvm_unreachable("Unable to handle InitListExpr");
// Get rid of control reaches end of void function warning.
// Not reached.
return 0;
if (Success && !Result.HasSideEffects) {
switch (Result.Val.getKind()) {
case APValue::Uninitialized:
- assert(0 && "Constant expressions should be initialized.");
+ llvm_unreachable("Constant expressions should be initialized.");
return 0;
case APValue::LValue: {
llvm::Type *DestTy = getTypes().ConvertTypeForMem(DestType);
Value *VisitStmt(Stmt *S) {
S->dump(CGF.getContext().getSourceManager());
- assert(0 && "Stmt can't have complex result type!");
+ llvm_unreachable("Stmt can't have complex result type!");
return 0;
}
Value *VisitExpr(Expr *S);
return EmitOverflowCheckedBinOp(BinOp);
break;
}
- assert(false && "Unknown SignedOverflowBehaviorTy");
+ llvm_unreachable("Unknown SignedOverflowBehaviorTy");
return 0;
}
IID = llvm::Intrinsic::smul_with_overflow;
break;
default:
- assert(false && "Unsupported operation for overflow detection");
+ llvm_unreachable("Unsupported operation for overflow detection");
IID = 0;
}
OpID <<= 1;
static llvm::Intrinsic::ID GetIntrinsic(IntrinsicType IT,
BuiltinType::Kind ElemKind) {
switch (ElemKind) {
- default: assert(0 && "unexpected element type");
+ default: llvm_unreachable("unexpected element type");
case BuiltinType::Char_U:
case BuiltinType::UChar:
return (IT == VCMPEQ) ? llvm::Intrinsic::ppc_altivec_vcmpequb_p :
BuiltinType::Kind ElementKind = BTy->getKind();
switch(E->getOpcode()) {
- default: assert(0 && "is not a comparison operation");
+ default: llvm_unreachable("is not a comparison operation");
case BO_EQ:
CR6 = CR6_LT;
ID = GetIntrinsic(VCMPEQ, ElementKind);
case BO_LOr:
case BO_Assign:
case BO_Comma:
- assert(false && "Not valid compound assignment operators");
+ llvm_unreachable("Not valid compound assignment operators");
break;
}
B.CreateCall2(GlobalAssignFn, src, dst);
else
// FIXME. Add threadloca assign API
- assert(false && "EmitObjCGlobalAssign - Threal Local API NYI");
+ llvm_unreachable("EmitObjCGlobalAssign - Threal Local API NYI");
}
void CGObjCGNU::EmitObjCIvarAssign(CodeGenFunction &CGF,
/// GetClassGlobal - Return the global variable for the Objective-C
/// class of the given name.
virtual llvm::GlobalVariable *GetClassGlobal(const std::string &Name) {
- assert(false && "CGObjCMac::GetClassGlobal");
+ llvm_unreachable("CGObjCMac::GetClassGlobal");
return 0;
}
};
virtual llvm::Value *EmitNSAutoreleasePoolClassRef(CGBuilderTy &Builder) {
- assert(false &&"autoreleasepool unsupported in this ABI");
- return 0;
+ llvm_unreachable("autoreleasepool unsupported in this ABI");
}
/// EnumerationMutationFunction - Return the function that's called by the
case BuiltinType::ObjCId:
case BuiltinType::ObjCClass:
case BuiltinType::ObjCSel:
- assert(false && "FIXME: Objective-C types are unsupported!");
+ llvm_unreachable("FIXME: Objective-C types are unsupported!");
}
// Silent gcc.
#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
- assert(false && "Non-canonical and dependent types shouldn't get here");
+ llvm_unreachable("Non-canonical and dependent types shouldn't get here");
case Type::LValueReference:
case Type::RValueReference:
- assert(false && "References shouldn't get here");
+ llvm_unreachable("References shouldn't get here");
case Type::Builtin:
// GCC treats vector and complex types as fundamental types.
#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
- assert(false && "Non-canonical and dependent types shouldn't get here");
+ llvm_unreachable("Non-canonical and dependent types shouldn't get here");
// GCC treats vector types as fundamental types.
case Type::Builtin:
case Type::LValueReference:
case Type::RValueReference:
- assert(false && "References shouldn't get here");
+ llvm_unreachable("References shouldn't get here");
case Type::ConstantArray:
case Type::IncompleteArray:
EmitObjCAtTryStmt(cast<ObjCAtTryStmt>(*S));
break;
case Stmt::ObjCAtCatchStmtClass:
- assert(0 && "@catch statements should be handled by EmitObjCAtTryStmt");
+ llvm_unreachable(
+ "@catch statements should be handled by EmitObjCAtTryStmt");
break;
case Stmt::ObjCAtFinallyStmtClass:
- assert(0 && "@finally statements should be handled by EmitObjCAtTryStmt");
+ llvm_unreachable(
+ "@finally statements should be handled by EmitObjCAtTryStmt");
break;
case Stmt::ObjCAtThrowStmtClass:
EmitObjCAtThrowStmt(cast<ObjCAtThrowStmt>(*S));
if (!const_cast<CXXRecordDecl *>(DerivedRD)->
isDerivedFrom(const_cast<CXXRecordDecl *>(BaseRD), Paths)) {
- assert(false && "Class must be derived from the passed in base class!");
+ llvm_unreachable("Class must be derived from the passed in base class!");
return BaseOffset();
}
CanBaseReturnType =
CanBaseReturnType->getAs<PointerType>()->getPointeeType();
} else {
- assert(false && "Unexpected return type!");
+ llvm_unreachable("Unexpected return type!");
}
// We need to compare unqualified types here; consider
return Offsets[I].second;
}
- assert(false && "Should always find a vcall offset offset!");
+ llvm_unreachable("Should always find a vcall offset offset!");
return CharUnits::Zero();
}
if (!const_cast<CXXRecordDecl *>(DerivedRD)->
isDerivedFrom(const_cast<CXXRecordDecl *>(BaseRD), Paths)) {
- assert(false && "Class must be derived from the passed in base class!");
+ llvm_unreachable("Class must be derived from the passed in base class!");
return BaseOffset();
}
}
if (!PrimaryBases.insert(PrimaryBase))
- assert(false && "Found a duplicate primary base!");
+ llvm_unreachable("Found a duplicate primary base!");
RD = PrimaryBase;
}
FirstBaseOffsetInLayoutClass, PrimaryBases);
if (!PrimaryBases.insert(PrimaryBase))
- assert(false && "Found a duplicate primary base!");
+ llvm_unreachable("Found a duplicate primary base!");
}
// Now go through all virtual member functions and add them.
CollectPrimaryBases(PrimaryBase, Context, PrimaryBases);
if (!PrimaryBases.insert(PrimaryBase))
- assert(false && "Found a duplicate primary base!");
+ llvm_unreachable("Found a duplicate primary base!");
}
void CodeGenVTables::ComputeMethodVTableIndices(const CXXRecordDecl *RD) {
return CI.createDefaultOutputFile(true, InFile, "o");
}
- assert(0 && "Invalid action!");
+ llvm_unreachable("Invalid action!");
return 0;
}
if (const VarDecl *VD = dyn_cast<VarDecl>(D))
return EmitGlobalVarDefinition(VD);
- assert(0 && "Invalid argument to EmitGlobalDefinition()");
+ llvm_unreachable("Invalid argument to EmitGlobalDefinition()");
}
/// GetOrCreateLLVMFunction - If the specified mangled name is not in the
return llvm::Type::getPPC_FP128Ty(VMContext);
if (&format == &llvm::APFloat::x87DoubleExtended)
return llvm::Type::getX86_FP80Ty(VMContext);
- assert(0 && "Unknown float format!");
+ llvm_unreachable("Unknown float format!");
return 0;
}
case SSEUp:
case X87Up:
- assert(0 && "Invalid classification for lo word.");
+ llvm_unreachable("Invalid classification for lo word.");
// AMD64-ABI 3.2.3p4: Rule 2. Types of class memory are returned via
// hidden argument.
// never occur as a hi class.
case Memory:
case X87:
- assert(0 && "Invalid classification for hi word.");
+ llvm_unreachable("Invalid classification for hi word.");
case ComplexX87: // Previously handled.
case NoClass:
case SSEUp:
case X87Up:
- assert(0 && "Invalid classification for lo word.");
+ llvm_unreachable("Invalid classification for lo word.");
// AMD64-ABI 3.2.3p3: Rule 2. If the class is INTEGER, the next
// available register of the sequence %rdi, %rsi, %rdx, %rcx, %r8
case Memory:
case X87:
case ComplexX87:
- assert(0 && "Invalid classification for hi word.");
+ llvm_unreachable("Invalid classification for hi word.");
break;
case NoClass: break;
case VerifyJobClass: return "verify";
}
- assert(0 && "invalid class");
+ llvm_unreachable("invalid class");
return 0;
}
llvm::PrettyStackTraceString CrashInfo("Constructing phase actions");
// Build the appropriate action.
switch (Phase) {
- case phases::Link: assert(0 && "link action invalid here.");
+ case phases::Link: llvm_unreachable("link action invalid here.");
case phases::Preprocess: {
types::ID OutputTy;
// -{M, MM} alter the output type.
return new AssembleJobAction(Input, types::TY_Object);
}
- assert(0 && "invalid phase in ConstructPhaseAction");
+ llvm_unreachable("invalid phase in ConstructPhaseAction");
return 0;
}
if (!(getInfo(i) < getInfo(i + 1))) {
getOption(i)->dump();
getOption(i + 1)->dump();
- assert(0 && "Options are not in order!");
+ llvm_unreachable("Options are not in order!");
}
}
#endif
// Add metavar, if used.
switch (Opts.getOptionKind(Id)) {
case Option::GroupClass: case Option::InputClass: case Option::UnknownClass:
- assert(0 && "Invalid option with help text.");
+ llvm_unreachable("Invalid option with help text.");
case Option::MultiArgClass:
- assert(0 && "Cannot print metavar for this kind of option.");
+ llvm_unreachable("Cannot print metavar for this kind of option.");
case Option::FlagClass:
break;
llvm::errs() << "<";
switch (Kind) {
default:
- assert(0 && "Invalid kind");
+ llvm_unreachable("Invalid kind");
#define P(N) case N: llvm::errs() << #N; break
P(GroupClass);
P(InputClass);
}
Arg *OptionGroup::accept(const ArgList &Args, unsigned &Index) const {
- assert(0 && "accept() should never be called on an OptionGroup");
+ llvm_unreachable("accept() should never be called on an OptionGroup");
return 0;
}
}
Arg *InputOption::accept(const ArgList &Args, unsigned &Index) const {
- assert(0 && "accept() should never be called on an InputOption");
+ llvm_unreachable("accept() should never be called on an InputOption");
return 0;
}
}
Arg *UnknownOption::accept(const ArgList &Args, unsigned &Index) const {
- assert(0 && "accept() should never be called on an UnknownOption");
+ llvm_unreachable("accept() should never be called on an UnknownOption");
return 0;
}
case Link: return "linker";
}
- assert(0 && "Invalid phase id.");
+ llvm_unreachable("Invalid phase id.");
return 0;
}
switch (Key) {
case Action::InputClass:
case Action::BindArchClass:
- assert(0 && "Invalid tool kind.");
+ llvm_unreachable("Invalid tool kind.");
case Action::PreprocessJobClass:
T = new tools::darwin::Preprocess(*this); break;
case Action::AnalyzeJobClass:
P.appendComponent("gcc");
switch (getTriple().getArch()) {
default:
- assert(0 && "Invalid Darwin arch!");
+ llvm_unreachable("Invalid Darwin arch!");
case llvm::Triple::x86:
case llvm::Triple::x86_64:
P.appendComponent("i686-apple-darwin10");
switch (Key) {
case Action::InputClass:
case Action::BindArchClass:
- assert(0 && "Invalid tool kind.");
+ llvm_unreachable("Invalid tool kind.");
case Action::PreprocessJobClass:
T = new tools::gcc::Preprocess(*this); break;
case Action::PrecompileJobClass:
case Action::AnalyzeJobClass:
T = new tools::Clang(*this); break;
default:
- assert(false && "Unsupported action for TCE target.");
+ llvm_unreachable("Unsupported action for TCE target.");
}
}
return *T;
case Action::LipoJobClass:
case Action::DsymutilJobClass:
case Action::VerifyJobClass:
- assert(0 && "Invalid tool kind.");
+ llvm_unreachable("Invalid tool kind.");
case Action::PreprocessJobClass:
case Action::PrecompileJobClass:
case Action::AnalyzeJobClass:
const char *darwin::CC1::getCC1Name(types::ID Type) const {
switch (Type) {
default:
- assert(0 && "Unexpected type for Darwin CC1 tool.");
+ llvm_unreachable("Unexpected type for Darwin CC1 tool.");
case types::TY_Asm:
case types::TY_C: case types::TY_CHeader:
case types::TY_PP_C: case types::TY_PP_CHeader:
}
default:
- assert(0 && "a decl that inherits DeclContext isn't handled");
+ llvm_unreachable("a decl that inherits DeclContext isn't handled");
}
Out << "\n";
}
default:
Out << "DeclKind: " << DK << '"' << *I << "\"\n";
- assert(0 && "decl unhandled");
+ llvm_unreachable("decl unhandled");
}
}
}
if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
switch (A->getOption().getID()) {
default:
- assert(0 && "Invalid option in group!");
+ llvm_unreachable("Invalid option in group!");
case OPT_ast_dump:
Opts.ProgramAction = frontend::ASTDump; break;
case OPT_ast_dump_xml:
case IK_None:
case IK_AST:
case IK_LLVM_IR:
- assert(0 && "Invalid input kind!");
+ llvm_unreachable("Invalid input kind!");
case IK_OpenCL:
LangStd = LangStandard::lang_opencl;
break;
llvm::SmallString<100> Buf;
Info.FormatDiagnostic(Buf);
switch (Level) {
- default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
+ default: llvm_unreachable(
+ "Diagnostic not handled during diagnostic buffering!");
case Diagnostic::Note:
Notes.push_back(std::make_pair(Info.getLocation(), Buf.str()));
break;
if (DiagOpts->ShowColors) {
// Print diagnostic category in bold and color
switch (Level) {
- case Diagnostic::Ignored: assert(0 && "Invalid diagnostic type");
+ case Diagnostic::Ignored: llvm_unreachable("Invalid diagnostic type");
case Diagnostic::Note: OS.changeColor(noteColor, true); break;
case Diagnostic::Warning: OS.changeColor(warningColor, true); break;
case Diagnostic::Error: OS.changeColor(errorColor, true); break;
}
switch (Level) {
- case Diagnostic::Ignored: assert(0 && "Invalid diagnostic type");
+ case Diagnostic::Ignored: llvm_unreachable("Invalid diagnostic type");
case Diagnostic::Note: OS << "note: "; break;
case Diagnostic::Warning: OS << "warning: "; break;
case Diagnostic::Error: OS << "error: "; break;
return 0;
switch (getKind()) {
- default: assert(0 && "Invalid Kind");
+ default: llvm_unreachable("Invalid Kind");
case N_Type:
return 0;
case N_Decl:
return SourceRange();
switch (getKind()) {
- default: assert(0 && "Invalid Kind");
+ default: llvm_unreachable("Invalid Kind");
return SourceRange();
case N_Decl:
return D->getSourceRange();
static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target) {
switch (kind) {
- default: assert(0 && "Unknown token type!");
+ default: llvm_unreachable("Unknown token type!");
case tok::char_constant:
case tok::string_literal:
case tok::utf8_string_literal:
bool Overflow = false;
switch (Operator) {
- default: assert(0 && "Unknown operator token!");
+ default: llvm_unreachable("Unknown operator token!");
case tok::percent:
if (RHS.Val != 0)
Res = LHS.Val % RHS.Val;
OS << (int)Value;
Tok.setKind(tok::numeric_constant);
} else {
- assert(0 && "Unknown identifier!");
+ llvm_unreachable("Unknown identifier!");
}
CreateString(OS.str().data(), OS.str().size(), Tok, Tok.getLocation());
}
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II->isStr("assert")) {
- assert(0 && "This is an assertion!");
+ llvm_unreachable("This is an assertion!");
} else if (II->isStr("crash")) {
*(volatile int*) 0x11 = 0;
} else if (II->isStr("llvm_fatal_error")) {
// TODO: Build AST.
switch (T) {
- default: assert(0 && "Not a builtin primary expression!");
+ default: llvm_unreachable("Not a builtin primary expression!");
case tok::kw___builtin_va_arg: {
ExprResult Expr(ParseAssignmentExpression());
case tok::kw_reinterpret_cast: return 3;
case tok::kw_static_cast: return 4;
default:
- assert(0 && "Unknown type for digraph error message.");
+ llvm_unreachable("Unknown type for digraph error message.");
return -1;
}
}
const char *CastName = 0; // For error messages
switch (Kind) {
- default: assert(0 && "Unknown C++ cast!"); abort();
+ default: llvm_unreachable("Unknown C++ cast!"); abort();
case tok::kw_const_cast: CastName = "const_cast"; break;
case tok::kw_dynamic_cast: CastName = "dynamic_cast"; break;
case tok::kw_reinterpret_cast: CastName = "reinterpret_cast"; break;
switch (Tok.getKind()) {
case tok::identifier: // foo::bar
case tok::coloncolon: // ::foo::bar
- assert(0 && "Annotation token should already be formed!");
+ llvm_unreachable("Annotation token should already be formed!");
default:
- assert(0 && "Not a simple-type-specifier token!");
+ llvm_unreachable("Not a simple-type-specifier token!");
abort();
// type-name
static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
switch(kind) {
- default: assert(false && "Not a known unary type trait.");
+ default: llvm_unreachable("Not a known unary type trait.");
case tok::kw___has_nothrow_assign: return UTT_HasNothrowAssign;
case tok::kw___has_nothrow_constructor: return UTT_HasNothrowConstructor;
case tok::kw___has_nothrow_copy: return UTT_HasNothrowCopy;
static ExpressionTrait ExpressionTraitFromTokKind(tok::TokenKind kind) {
switch(kind) {
- default: assert(false && "Not a known unary expression trait.");
+ default: llvm_unreachable("Not a known unary expression trait.");
case tok::kw___is_lvalue_expr: return ET_IsLValueExpr;
case tok::kw___is_rvalue_expr: return ET_IsRValueExpr;
}
ObjCDeclSpec::ObjCDeclQualifier Qual;
switch (i) {
- default: assert(0 && "Unknown decl qualifier");
+ default: llvm_unreachable("Unknown decl qualifier");
case objc_in: Qual = ObjCDeclSpec::DQ_In; break;
case objc_out: Qual = ObjCDeclSpec::DQ_Out; break;
case objc_inout: Qual = ObjCDeclSpec::DQ_Inout; break;
void RewriteObjC::RewriteForwardProtocolDecl(ObjCForwardProtocolDecl *PDecl) {
SourceLocation LocStart = PDecl->getLocation();
if (LocStart.isInvalid())
- assert(false && "Invalid SourceLocation");
+ llvm_unreachable("Invalid SourceLocation");
// FIXME: handle forward protocol that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
}
// declares the @catch parameter).
ReplaceText(rParenLoc, bodyBuf-rParenBuf+1, " = _caught;");
} else {
- assert(false && "@catch rewrite bug");
+ llvm_unreachable("@catch rewrite bug");
}
}
// Complete the catch list...
}
// Mark this struct as having been generated.
if (!ObjCSynthesizedStructs.insert(CDecl))
- assert(false && "struct already synthesize- SynthesizeObjCInternalStruct");
+ llvm_unreachable("struct already synthesize- SynthesizeObjCInternalStruct");
}
// RewriteObjCMethodsMetaData - Rewrite methods metadata for instance or
// Mark this protocol as having been generated.
if (!ObjCSynthesizedProtocols.insert(PDecl))
- assert(false && "protocol already synthesized");
+ llvm_unreachable("protocol already synthesized");
}
else if (FieldDecl *FD = dyn_cast<FieldDecl>(ND))
DeclT = FD->getType();
else
- assert(0 && "RewriteBlockPointerDecl(): Decl type not yet handled");
+ llvm_unreachable("RewriteBlockPointerDecl(): Decl type not yet handled");
const char *startBuf = SM->getCharacterData(DeclLoc);
const char *endBuf = startBuf;
else if (ObjCCategoryImplDecl *CI = dyn_cast<ObjCCategoryImplDecl>(D))
CategoryImplementation.push_back(CI);
else if (isa<ObjCClassDecl>(D))
- assert(false && "RewriteObjC::HandleDeclInMainFile - ObjCClassDecl");
+ llvm_unreachable("RewriteObjC::HandleDeclInMainFile - ObjCClassDecl");
else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
RewriteObjCQualifiedInterfaceTypes(VD);
if (isTopLevelBlockPointerType(VD->getType()))
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;
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;
}
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";
}
}
}
- 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
break;
default:
- assert(0 && "Invalid #pragma pack kind.");
+ llvm_unreachable("Invalid #pragma pack kind.");
}
}
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:
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;
break;
default:
- assert(false && "Unknown type specifier kind in CodeCompleteTag");
+ llvm_unreachable("Unknown type specifier kind in CodeCompleteTag");
return;
}
} // switch (Name.getKind())
- assert(false && "Unknown name kind");
+ llvm_unreachable("Unknown name kind");
return DeclarationNameInfo();
}
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:
}
}
- assert(0 && "found no user-declared constructors");
+ llvm_unreachable("found no user-declared constructors");
return;
}
break;
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).
}
}
- 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
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;
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(),
}
case CXXInvalid:
- assert(false && "Invalid special member.");
+ llvm_unreachable("Invalid special member.");
break;
}
} else {
DiagnoseUnimplementedProperties(S, IMPDecl, CDecl, InsMap);
}
} else
- assert(false && "invalid ObjCContainerDecl type.");
+ llvm_unreachable("invalid ObjCContainerDecl type.");
}
/// ActOnForwardClassDeclaration -
break;
default:
- assert(false && "This spec type is compatible with none.");
+ llvm_unreachable("This spec type is compatible with none.");
}
OS.flush();
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;
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;
}
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,
}
}
} 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) {
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;
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;
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;
}
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;
return true;
}
}
- assert(false && "Unreachable, bad result from BestViableFunction");
+ llvm_unreachable("Unreachable, bad result from BestViableFunction");
return true;
}
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);
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:
break;
default:
- assert(false && "Improper first standard conversion");
+ llvm_unreachable("Improper first standard conversion");
break;
}
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;
}
}
default:
- assert(false && "Improper third standard conversion");
+ llvm_unreachable("Improper third standard conversion");
break;
}
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;
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(),
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;
break;
default:
- assert(false &&
+ llvm_unreachable(
"Can only end up with a standard conversion sequence or failure");
}
}
buildObjCPtr = true;
}
else
- assert(false && "type was not a pointer type!");
+ llvm_unreachable("type was not a pointer type!");
}
else
PointeeTy = PointerTy->getPointeeType();
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:
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:
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;
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");
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();
}
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;
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: {
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:
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:
break;
}
- assert(false && "Missing specialization/instantiation case?");
+ llvm_unreachable("Missing specialization/instantiation case?");
return false;
}
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:
switch (X.getKind()) {
case TemplateArgument::Null:
- assert(false && "Comparing NULL template argument");
+ llvm_unreachable("Comparing NULL template argument");
break;
case TemplateArgument::Type:
Decl *
TemplateDeclInstantiator::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
- assert(false && "Translation units cannot be instantiated");
+ llvm_unreachable("Translation units cannot be instantiated");
return D;
}
Decl *
TemplateDeclInstantiator::VisitNamespaceDecl(NamespaceDecl *D) {
- assert(false && "Namespaces cannot be instantiated");
+ llvm_unreachable("Namespaces cannot be instantiated");
return D;
}
}
Decl *TemplateDeclInstantiator::VisitEnumConstantDecl(EnumConstantDecl *D) {
- assert(false && "EnumConstantDecls can only occur within EnumDecls.");
+ llvm_unreachable("EnumConstantDecls can only occur within EnumDecls.");
return 0;
}
// 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.
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:
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;
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;
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");
}
SubExpr, RParenLoc);
default:
- assert(false && "Invalid C++ named cast");
+ llvm_unreachable("Invalid C++ named cast");
break;
}
}
}
- assert(0 && "Unknown name kind.");
+ llvm_unreachable("Unknown name kind.");
return DeclarationNameInfo();
}
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);
}
}
}
- assert(0 && "Unhandled template name kind!");
+ llvm_unreachable("Unhandled template name kind!");
return TemplateName();
}
}
}
- assert(0 && "Unhandled template argument kind!");
+ llvm_unreachable("Unhandled template argument kind!");
return TemplateArgument();
}
ReadDeclarationNameLoc(FD->DNLoc, FD->getDeclName(), Record, Idx);
FD->IdentifierNamespace = Record[Idx++];
switch ((FunctionDecl::TemplatedKind)Record[Idx++]) {
- default: assert(false && "Unhandled TemplatedKind!");
+ default: llvm_unreachable("Unhandled TemplatedKind!");
break;
case FunctionDecl::TK_NonTemplate:
break;
};
switch ((CXXRecKind)Record[Idx++]) {
default:
- assert(false && "Out of sync with ASTDeclWriter::VisitCXXRecordDecl?");
+ llvm_unreachable("Out of sync with ASTDeclWriter::VisitCXXRecordDecl?");
case CXXRecNotTemplate:
break;
case CXXRecTemplate:
RedeclKind Kind = (RedeclKind)Record[Idx++];
switch (Kind) {
default:
- assert(0 && "Out of sync with ASTDeclWriter::VisitRedeclarable or messed up"
- " reading");
+ llvm_unreachable("Out of sync with ASTDeclWriter::VisitRedeclarable or"
+ " messed up reading");
case NoRedeclaration:
break;
case PointsToPrevious: {
switch ((DeclCode)DeclsCursor.ReadRecord(Code, Record)) {
case DECL_CONTEXT_LEXICAL:
case DECL_CONTEXT_VISIBLE:
- assert(false && "Record cannot be de-serialized with ReadDeclRecord");
+ llvm_unreachable("Record cannot be de-serialized with ReadDeclRecord");
break;
case DECL_TYPEDEF:
D = TypedefDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
}
void ASTTypeWriter::VisitBuiltinType(const BuiltinType *T) {
- assert(false && "Built-in types are never serialized");
+ llvm_unreachable("Built-in types are never serialized");
}
void ASTTypeWriter::VisitComplexType(const ComplexType *T) {
ASTTypeWriter::VisitDependentSizedExtVectorType(
const DependentSizedExtVectorType *T) {
// FIXME: Serialize this type (C++ only)
- assert(false && "Cannot serialize dependent sized extended vector types");
+ llvm_unreachable("Cannot serialize dependent sized extended vector types");
}
void
Record.push_back(D->getIdentifierNamespace());
Record.push_back(D->getTemplatedKind());
switch (D->getTemplatedKind()) {
- default: assert(false && "Unhandled TemplatedKind!");
+ default: llvm_unreachable("Unhandled TemplatedKind!");
break;
case FunctionDecl::TK_NonTemplate:
break;
SourceManager &SrcMgr
= DeclIDs.begin()->first->getASTContext().getSourceManager();
S->dump(SrcMgr);
- assert(0 && "Unhandled sub statement writing AST file");
+ llvm_unreachable("Unhandled sub statement writing AST file");
}
#endif
range = TOR->getExpr()->getSourceRange();
}
else {
- assert(false && "Invalid region in ReturnStackAddressChecker.");
+ llvm_unreachable("Invalid region in ReturnStackAddressChecker.");
}
return range;
void AggExprVisitor::VisitCastExpr(CastExpr *E) {
switch (E->getCastKind()) {
default:
- assert(0 && "Unhandled cast kind");
+ llvm_unreachable("Unhandled cast kind");
case CK_NoOp:
case CK_ConstructorConversion:
case CK_UserDefinedConversion:
if (!errorNode)
continue;
if (errorNode->isSink()) {
- assert(false &&
+ llvm_unreachable(
"BugType::isSuppressSink() should not be 'true' for sink end nodes");
return 0;
}
if (const Stmt *Term = B->getTerminator()) {
switch (Term->getStmtClass()) {
default:
- assert(false && "Analysis for this terminator not implemented.");
+ llvm_unreachable("Analysis for this terminator not implemented.");
break;
case Stmt::BinaryOperatorClass: // '&&' and '||'
const ProgramPointTag *tag){
switch (K) {
default:
- assert(false && "Unhandled ProgramPoint kind");
+ llvm_unreachable("Unhandled ProgramPoint kind");
case ProgramPoint::PreStmtKind:
return PreStmt(S, LC, tag);
case ProgramPoint::PostStmtKind:
}
}
- assert(false && "No block with label.");
+ llvm_unreachable("No block with label.");
return;
}
switch (Op) {
default:
- assert(0 && "Invalid opcode for compound assignment.");
+ llvm_unreachable("Invalid opcode for compound assignment.");
case BO_MulAssign: Op = BO_Mul; break;
case BO_DivAssign: Op = BO_Div; break;
case BO_RemAssign: Op = BO_Rem; break;
switch (CastE->getCastKind()) {
case CK_LValueToRValue:
- assert(false && "LValueToRValue casts handled earlier.");
+ llvm_unreachable("LValueToRValue casts handled earlier.");
case CK_GetObjCProperty:
- assert(false && "GetObjCProperty casts handled earlier.");
+ llvm_unreachable("GetObjCProperty casts handled earlier.");
case CK_ToVoid:
Dst.Add(Pred);
continue;
switch (U->getOpcode()) {
default:
- assert(false && "Invalid Opcode.");
+ llvm_unreachable("Invalid Opcode.");
break;
case UO_Not:
}
if (isa<CodeTextRegion>(MR)) {
- assert(0 && "Why load from a code text region?");
+ llvm_unreachable("Why load from a code text region?");
return UnknownVal();
}
if (isa<nonloc::LazyCompoundVal>(val))
return Optional<SVal>();
- assert(0 && "Unknown default value");
+ llvm_unreachable("Unknown default value");
}
return Optional<SVal>();
return;
}
- assert(false && "unhandled expansion case");
+ llvm_unreachable("unhandled expansion case");
}
const void *nonloc::LazyCompoundVal::getStore() const {
break;
}
default:
- assert(false && "Pretty-printing not implemented for this Loc.");
+ llvm_unreachable("Pretty-printing not implemented for this Loc.");
break;
}
}
// the only place it's used. (This code was copied from SimpleSValBuilder.cpp.)
switch (op) {
default:
- assert(false && "Invalid opcode.");
+ llvm_unreachable("Invalid opcode.");
case BO_LT: return BO_GE;
case BO_GT: return BO_LE;
case BO_LE: return BO_GT;
switch (Cond.getSubKind()) {
default:
- assert(false && "'Assume' not implemented for this NonLoc");
+ llvm_unreachable("'Assume' not implemented for this NonLoc");
case nonloc::SymbolValKind: {
nonloc::SymbolVal& SV = cast<nonloc::SymbolVal>(Cond);
static BinaryOperator::Opcode NegateComparison(BinaryOperator::Opcode op) {
switch (op) {
default:
- assert(false && "Invalid opcode.");
+ llvm_unreachable("Invalid opcode.");
case BO_LT: return BO_GE;
case BO_GT: return BO_LE;
case BO_LE: return BO_GT;
static BinaryOperator::Opcode ReverseComparison(BinaryOperator::Opcode op) {
switch (op) {
default:
- assert(false && "Invalid opcode.");
+ llvm_unreachable("Invalid opcode.");
case BO_LT: return BO_GT;
case BO_GT: return BO_LT;
case BO_LE: return BO_GE;
break;
case BO_LAnd:
case BO_LOr:
- assert(false && "Logical operators handled by branching logic.");
+ llvm_unreachable("Logical operators handled by branching logic.");
return UnknownVal();
case BO_Assign:
case BO_MulAssign:
case BO_XorAssign:
case BO_OrAssign:
case BO_Comma:
- assert(false && "'=' and ',' operators handled by ExprEngine.");
+ llvm_unreachable("'=' and ',' operators handled by ExprEngine.");
return UnknownVal();
case BO_PtrMemD:
case BO_PtrMemI:
- assert(false && "Pointer arithmetic not handled here.");
+ llvm_unreachable("Pointer arithmetic not handled here.");
return UnknownVal();
case BO_LT:
case BO_GT:
if (lhs == rhs) {
switch (op) {
default:
- assert(false && "Unimplemented operation for two identical values");
+ llvm_unreachable("Unimplemented operation for two identical values");
return UnknownVal();
case BO_Sub:
return makeZeroVal(resultTy);
switch (lhs.getSubKind()) {
default:
- assert(false && "Ordering not implemented for this Loc.");
+ llvm_unreachable("Ordering not implemented for this Loc.");
return UnknownVal();
case loc::GotoLabelKind:
return makeTruthVal(!leftFirst, resultTy);
}
- assert(false && "Fields not found in parent record's definition");
+ llvm_unreachable("Fields not found in parent record's definition");
}
// If we get here, we have no way of comparing the regions.
case MemRegion::UnknownSpaceRegionKind:
case MemRegion::NonStaticGlobalSpaceRegionKind:
case MemRegion::StaticGlobalSpaceRegionKind: {
- assert(0 && "Invalid region cast");
+ llvm_unreachable("Invalid region cast");
break;
}
}
}
- assert(0 && "unreachable");
+ llvm_unreachable("unreachable");
return 0;
}
return Base;
default:
- assert(0 && "Unhandled Base.");
+ llvm_unreachable("Unhandled Base.");
return Base;
}
static void print(raw_ostream &os, BinaryOperator::Opcode Op) {
switch (Op) {
default:
- assert(false && "operator printing not implemented");
+ llvm_unreachable("operator printing not implemented");
break;
case BO_Mul: os << '*' ; break;
case BO_Div: os << '/' ; break;
// Create the analyzer component creators.
switch (Opts.AnalysisStoreOpt) {
default:
- assert(0 && "Unknown store manager.");
+ llvm_unreachable("Unknown store manager.");
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATEFN) \
case NAME##Model: CreateStoreMgr = CREATEFN; break;
#include "clang/Frontend/Analyses.def"
switch (Opts.AnalysisConstraintsOpt) {
default:
- assert(0 && "Unknown store manager.");
+ llvm_unreachable("Unknown store manager.");
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATEFN) \
case NAME##Model: CreateConstraintMgr = CREATEFN; break;
#include "clang/Frontend/Analyses.def"
SourceLocation TokLoc = GetTokenLoc(I);
switch (LocationCompare(SrcMgr, TokLoc, cursorRange)) {
case RangeBefore:
- assert(0 && "Infeasible");
+ llvm_unreachable("Infeasible");
case RangeAfter:
break;
case RangeOverlap:
/* Print warning/error/etc. */
switch (Severity) {
- case CXDiagnostic_Ignored: assert(0 && "impossible"); break;
+ case CXDiagnostic_Ignored: llvm_unreachable("impossible"); break;
case CXDiagnostic_Note: Out << "note: "; break;
case CXDiagnostic_Warning: Out << "warning: "; break;
case CXDiagnostic_Error: Out << "error: "; break;
void USRGenerator::VisitObjCContainerDecl(ObjCContainerDecl *D) {
switch (D->getKind()) {
default:
- assert(false && "Invalid ObjC container.");
+ llvm_unreachable("Invalid ObjC container.");
case Decl::ObjCInterface:
case Decl::ObjCImplementation:
GenObjCClass(D->getName());
// This silly cast below avoids a C++ warning.
Dl_info info;
if (dladdr((void *)(uintptr_t)clang_createTranslationUnit, &info) == 0)
- assert(0 && "Call to dladdr() failed");
+ llvm_unreachable("Call to dladdr() failed");
llvm::sys::Path LibClangPath(info.dli_fname);