diff gen/classes.cpp @ 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
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();