Mercurial > projects > ldc
changeset 670:4f004553de33
Fixed dynamic array -> boolean. does (arr.ptr !is null) now instead of (arr.length != 0)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 08 Oct 2008 22:38:52 +0200 |
parents | 92ec7487a1a0 |
children | 22b6947fd30c |
files | gen/llvmhelpers.cpp tests/mini/strings2.d |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Wed Oct 08 20:28:59 2008 +0200 +++ b/gen/llvmhelpers.cpp Wed Oct 08 22:38:52 2008 +0200 @@ -1562,8 +1562,10 @@ // dynamic array else if (ty == Tarray) { - // return (arr.length != 0) - return gIR->ir->CreateICmpNE(DtoArrayLen(dval), DtoConstSize_t(0), "tmp"); + // return (arr.ptr !is null) + LLValue* ptr = DtoArrayPtr(dval); + LLConstant* nul = getNullPtr(ptr->getType()); + return gIR->ir->CreateICmpNE(ptr, nul, "tmp"); } // delegate else if (ty == Tdelegate)