Mercurial > projects > ldc
changeset 111:a7ae554ce4f4 trunk
[svn r115] Implemented the ClassInfo.defaultConstructor member.
author | lindquist |
---|---|
date | Thu, 22 Nov 2007 21:17:54 +0100 |
parents | e8da7856a260 |
children | 368547b1cbe6 |
files | gen/classes.cpp llvmdc.kdevelop.filelist test/classinfo4.d |
diffstat | 3 files changed, 28 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/classes.cpp Thu Nov 22 21:01:01 2007 +0100 +++ b/gen/classes.cpp Thu Nov 22 21:17:54 2007 +0100 @@ -632,13 +632,19 @@ inits.push_back(c); // offset typeinfo - // TODO c = build_offti_array(cd, cinfo->llvmInitZ->getOperand(10)); inits.push_back(c); // default constructor - // TODO - c = cinfo->llvmInitZ->getOperand(11); + if (cd->defaultCtor) { + DtoForceDeclareDsymbol(cd->defaultCtor); + c = isaConstant(cd->defaultCtor->llvmValue); + //const llvm::Type* toTy = cinfo->llvmInitZ->getOperand(11)->getType(); + c = llvm::ConstantExpr::getBitCast(c, llvm::PointerType::get(llvm::Type::Int8Ty)); // toTy); + } + else { + c = cinfo->llvmInitZ->getOperand(11); + } inits.push_back(c); /*size_t n = inits.size();
--- a/llvmdc.kdevelop.filelist Thu Nov 22 21:01:01 2007 +0100 +++ b/llvmdc.kdevelop.filelist Thu Nov 22 21:17:54 2007 +0100 @@ -337,6 +337,7 @@ test/classinfo1.d test/classinfo2.d test/classinfo3.d +test/classinfo4.d test/comma.d test/complex1.d test/complex2.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classinfo4.d Thu Nov 22 21:17:54 2007 +0100 @@ -0,0 +1,18 @@ +module classinfo4; + +class C +{ +} + +class D +{ + this() + { + } +} + +void main() +{ + assert(C.classinfo.defaultConstructor is null); + assert(D.classinfo.defaultConstructor !is null); +}