diff ir/irclass.cpp @ 1463:a5526b7a5ae6

D2: Applied function type from D1 frontend that got removed in D2, it's critical for member function type to be correct. Fixed a bunch of type discrepancies in druntime object.di vs. genobj.d . Disabled (#if 0) some potentally very large type dumps for -vv . Updated classinfo and typeinfo generation for D2, almost complete now. Added finer grained checks for vtbl type mismatching, aids debugging.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Wed, 03 Jun 2009 02:28:48 +0200
parents ed70675862c8
children ad7f2f1862d6
line wrap: on
line diff
--- a/ir/irclass.cpp	Tue Jun 02 20:28:53 2009 +0200
+++ b/ir/irclass.cpp	Wed Jun 03 02:28:48 2009 +0200
@@ -178,6 +178,24 @@
    IF_LOG Logger::cout() << "constVtbl type: " << *constVtbl->getType() << std::endl;
    IF_LOG Logger::cout() << "vtbl type: " << *type->irtype->isClass()->getVtbl() << std::endl;
 #endif
+
+#if 1
+
+    size_t nc = constants.size();
+    const LLType* vtblTy = type->irtype->isClass()->getVtbl();
+    for (size_t i = 0; i < nc; ++i)
+    {
+        if (constVtbl->getOperand(i)->getType() != vtblTy->getContainedType(i))
+        {
+            Logger::cout() << "type mismatch for entry # " << i << " in vtbl initializer" << std::endl;
+
+            constVtbl->getOperand(i)->dump();
+            vtblTy->getContainedType(i)->dump(gIR->module);
+        }
+    }
+
+#endif
+
     assert(constVtbl->getType() == type->irtype->isClass()->getVtbl() &&
         "vtbl initializer type mismatch");