diff ir/irtypeclass.cpp @ 1230:e67c85d6e680

Completed interface implementation. Hopefully that's it for now..
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 16 Apr 2009 13:18:56 +0200
parents 79758fd2f48a
children 212ec2d9d176
line wrap: on
line diff
--- a/ir/irtypeclass.cpp	Thu Apr 16 11:01:49 2009 +0200
+++ b/ir/irtypeclass.cpp	Thu Apr 16 13:18:56 2009 +0200
@@ -24,6 +24,7 @@
     vtbl_pa(llvm::OpaqueType::get())
 {
     vtbl_size = cd->vtbl.dim;
+    num_interface_vtbls = 0;
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -91,6 +92,9 @@
 
         ArrayIter<BaseClass> it2(*base->vtblInterfaces);
 
+        VarDeclarationIter interfaces_idx(ClassDeclaration::classinfo->fields, 3);
+        Type* first = interfaces_idx->type->next->pointerTo();
+
         for (; !it2.done(); it2.next())
         {
             BaseClass* b = it2.get();
@@ -99,15 +103,19 @@
             Array arr;
             b->fillVtbl(cd, &arr, new_instances);
 
-            const llvm::Type* ivtbl_type = buildVtblType(Type::tvoid->pointerTo(), &arr);
+            const llvm::Type* ivtbl_type = buildVtblType(first, &arr);
             defaultTypes.push_back(llvm::PointerType::get(ivtbl_type, 0));
 
             offset += PTRSIZE;
 
             // add to the interface map
+            // FIXME: and all it's baseinterfaces
             if (interfaceMap.find(b->base) == interfaceMap.end())
                 interfaceMap.insert(std::make_pair(b->base, field_index));
             field_index++;
+
+            // inc count
+            num_interface_vtbls++;
         }
     }