Mercurial > projects > ldc
diff gen/classes.cpp @ 778:4adf0f742896
Get rid of DtoBoolean - use DtoCast(... Type::tbool) instead.
Fixed some casts to bool that were using truncation.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 22 Nov 2008 18:35:52 +0100 |
parents | f04dde6e882c |
children | 6e7a4c3b64d2 |
line wrap: on
line diff
--- a/gen/classes.cpp Sat Nov 22 13:41:36 2008 +0100 +++ b/gen/classes.cpp Sat Nov 22 18:35:52 2008 +0100 @@ -924,10 +924,17 @@ Type* to = _to->toBasetype(); if (to->ty == Tpointer) { + Logger::println("to pointer"); const LLType* tolltype = DtoType(_to); LLValue* rval = DtoBitCast(val->getRVal(), tolltype); return new DImValue(_to, rval); } + else if (to->ty == Tbool) { + Logger::println("to bool"); + LLValue* llval = val->getRVal(); + LLValue* zero = LLConstant::getNullValue(llval->getType()); + return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero, "tmp")); + } assert(to->ty == Tclass); TypeClass* tc = (TypeClass*)to; @@ -947,7 +954,7 @@ } } else { - Logger::println("to object"); + Logger::println("to class"); int poffset; if (fc->sym->isInterfaceDeclaration()) { Logger::println("interface cast");