[svn r115] Implemented the ClassInfo.defaultConstructor member.

This commit is contained in:
Tomas Lindquist Olsen
2007-11-22 21:17:54 +01:00
parent be1fcd6a24
commit ccaf229830
3 changed files with 28 additions and 3 deletions

View File

@@ -632,13 +632,19 @@ L2:
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();

View File

@@ -337,6 +337,7 @@ test/classes8.d
test/classinfo1.d
test/classinfo2.d
test/classinfo3.d
test/classinfo4.d
test/comma.d
test/complex1.d
test/complex2.d

18
test/classinfo4.d Normal file
View File

@@ -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);
}