Use llvm_unreachable instead of assert(0).

Also removed some unused functions.
This commit is contained in:
David Nadlinger 2013-02-07 03:38:15 +01:00
parent 28a65ff689
commit 8ff3a8060a
18 changed files with 68 additions and 166 deletions

View file

@ -477,9 +477,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
// T[n] = T[] - generally only generated by frontend in rare cases
else if (t2->ty == Tarray && t->nextOf()->toBasetype()->equals(t2->nextOf()->toBasetype())) {
DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs));
} else {
assert(0 && "Unimplemented static array assign!");
}
} else llvm_unreachable("Unimplemented static array assign!");
}
else if (t->ty == Tdelegate) {
LLValue* l = lhs->getLVal();
@ -575,11 +573,7 @@ DValue* DtoNullValue(Type* type)
return new DNullValue(type, LLConstant::getNullValue(lltype));
}
// unknown
error("unsupported: null value for %s", type->toChars());
assert(0);
return 0;
llvm_unreachable("null not known for this type.");
}
@ -1009,8 +1003,7 @@ void DtoResolveDsymbol(Dsymbol* dsym)
DtoResolveTypeInfo(fd);
}
else {
error(dsym->loc, "unsupported dsymbol: %s", dsym->toChars());
assert(0 && "unsupported dsymbol for DtoResolveDsymbol");
llvm_unreachable("Unsupported DSymbol for DtoResolveDsymbol.");
}
}
@ -1256,11 +1249,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
else if (TupleDeclaration* tupled = declaration->isTupleDeclaration())
{
Logger::println("TupleDeclaration");
if(!tupled->isexp) {
error(declaration->loc, "don't know how to handle non-expression tuple decls yet");
assert(0);
}
assert(tupled->isexp && "Non-expression tuple decls not handled yet.");
assert(tupled->objects);
for (unsigned i=0; i < tupled->objects->dim; ++i)
{
@ -1274,13 +1263,10 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
Logger::println("TemplateDeclaration");
// do nothing
}
// unsupported declaration
else
{
error(declaration->loc, "Unimplemented Declaration type for DeclarationExp. kind: %s", declaration->kind());
assert(0);
llvm_unreachable("Unimplemented Declaration type for DeclarationExp.");
}
return NULL;
}
// does pretty much the same as DtoDeclarationExp, except it doesn't initialize, and only handles var declarations
@ -1462,14 +1448,14 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
{
// do nothing
}
else if (init->isStructInitializer()) {
else if (init->isStructInitializer())
{
// TODO: again nothing ?
}
else {
Logger::println("unsupported initializer: %s", init->toChars());
assert(0);
else
{
llvm_unreachable("Unknown initializer type.");
}
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
@ -1538,8 +1524,9 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp)
Logger::println("type is a static array, building constant array initializer to single value");
return expand_to_sarray(base, exp);
}
#if DMDV2
else if (base->ty == Tvector)
if (base->ty == Tvector)
{
LLConstant* val = exp->toConstElem(gIR);
TypeVector* tv = (TypeVector*)base;
@ -1551,13 +1538,10 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp)
#endif
}
#endif
else
{
error(loc, "LDC internal error: cannot yet convert default initializer %s of type %s to %s",
exp->toChars(), exp->type->toChars(), type->toChars());
fatal();
}
assert(0);
error(loc, "LDC internal error: cannot yet convert default initializer %s of type %s to %s",
exp->toChars(), exp->type->toChars(), type->toChars());
llvm_unreachable("Unsupported default initializer.");
}
return exp->toConstElem(gIR);