DMD Issue 5416 - null should have a type of its own

This commit is contained in:
Alexey Prokhin
2011-12-16 20:15:10 +04:00
parent 88cff99bd4
commit edc4a5f003
7 changed files with 21 additions and 4 deletions
+2
View File
@@ -96,6 +96,8 @@ void ReturnStatement::toIR(IRState* p)
if (!exp && (p->topfunc() == p->mainFunc)) {
v = LLConstant::getNullValue(p->mainFunc->getReturnType());
} else {
if (exp->op == TOKnull)
exp->type = p->func()->type->next;
#if DMDV2
DValue* dval = 0;
// call postblit if necessary
+2 -2
View File
@@ -1551,7 +1551,7 @@ DValue* CmpExp::toElem(IRState* p)
LLValue* eval = 0;
if (t->isintegral() || t->ty == Tpointer)
if (t->isintegral() || t->ty == Tpointer || t->ty == Tnull)
{
llvm::ICmpInst::Predicate cmpop;
bool skip = false;
@@ -1677,7 +1677,7 @@ DValue* EqualExp::toElem(IRState* p)
// the Tclass catches interface comparisons, regular
// class equality should be rewritten as a.opEquals(b) by this time
if (t->isintegral() || t->ty == Tpointer || t->ty == Tclass)
if (t->isintegral() || t->ty == Tpointer || t->ty == Tclass || t->ty == Tnull)
{
Logger::println("integral or pointer or interface");
llvm::ICmpInst::Predicate cmpop;
+1
View File
@@ -95,6 +95,7 @@ LLType* DtoType(Type* t)
}
// pointers
case Tnull:
case Tpointer:
{
t->irtype = new IrTypePointer(t);
+5 -1
View File
@@ -380,7 +380,11 @@ void DtoDeclareTypeInfo(TypeInfoDeclaration* tid)
void TypeInfoDeclaration::llvmDefine()
{
assert(0 && "cannot generate generic typeinfo");
Logger::println("TypeInfoDeclaration::llvmDefine() %s", toChars());
LOG_SCOPE;
RTTIBuilder b(Type::typeinfo);
b.finalize(ir.irGlobal);
}
/* ========================================================================= */