diff dmd/mtype.c @ 103:855adfdb8d38 trunk

[svn r107] Getting .classinfo on a class instance now works (classinfo is stored in vtable)
author lindquist
date Sun, 18 Nov 2007 08:25:07 +0100
parents 027b8d8b71ec
children 288fe1029e1f
line wrap: on
line diff
--- a/dmd/mtype.c	Sun Nov 18 06:52:57 2007 +0100
+++ b/dmd/mtype.c	Sun Nov 18 08:25:07 2007 +0100
@@ -4502,9 +4502,24 @@
 		e->type = t;	// do this so we don't get redundant dereference
 	    }
 	    else
-	    {	/* For class objects, the classinfo reference is the first
-		 * entry in the vtbl[]
-		 */
+	    {
+        /* For class objects, the classinfo reference is the first
+         * entry in the vtbl[]
+         */
+#if IN_LLVM
+
+        e = e->castTo(sc, t->pointerTo()->pointerTo());
+        e = new PtrExp(e->loc, e);
+        e->type = t->pointerTo();
+        e = new PtrExp(e->loc, e);
+        e->type = t;
+        if (sym->isInterfaceDeclaration())
+        {
+            assert(0 && "No interfaces yet!");
+        }
+
+#else
+
 		e = new PtrExp(e->loc, e);
 		e->type = t->pointerTo();
 		if (sym->isInterfaceDeclaration())
@@ -4526,6 +4541,8 @@
 		    e->type = t->pointerTo();
 		}
 		e = new PtrExp(e->loc, e, t);
+
+#endif
 	    }
 	    return e;
 	}