diff gen/typinf.cpp @ 1228:79758fd2f48a

Added Doxygen file. Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Wed, 15 Apr 2009 20:06:25 +0200
parents 19d4ded7204a
children 465a77c904d4
line wrap: on
line diff
--- a/gen/typinf.cpp	Mon Apr 13 17:42:36 2009 +0200
+++ b/gen/typinf.cpp	Wed Apr 15 20:06:25 2009 +0200
@@ -253,20 +253,6 @@
 
 /* ========================================================================= */
 
-/***************************************
- * Create a static array of TypeInfo references
- * corresponding to an array of Expression's.
- * Used to supply hidden _arguments[] value for variadic D functions.
- */
-
-Expression *createTypeInfoArray(Scope *sc, Expression *exps[], int dim)
-{
-    assert(0); // done elsewhere in LDC
-    return NULL;
-}
-
-/* ========================================================================= */
-
 //////////////////////////////////////////////////////////////////////////////
 //                             MAGIC   PLACE
 //////////////////////////////////////////////////////////////////////////////
@@ -376,7 +362,7 @@
 
     // vtbl
     std::vector<LLConstant*> sinits;
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(getNullPtr(getPtrToType(LLType::Int8Ty)));
@@ -433,7 +419,7 @@
 
     // vtbl
     std::vector<LLConstant*> sinits;
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -491,7 +477,7 @@
 
     // vtbl
     std::vector<LLConstant*> sinits;
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -553,7 +539,7 @@
     // initializer vector
     std::vector<LLConstant*> sinits;
     // first is always the vtable
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -592,7 +578,7 @@
     // initializer vector
     std::vector<LLConstant*> sinits;
     // first is always the vtable
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -664,7 +650,7 @@
 
     // vtbl
     std::vector<LLConstant*> sinits;
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -687,7 +673,7 @@
 #endif
     {
         size_t cisize = getTypeStoreSize(tc->ir.type->get());
-        LLConstant* cicast = llvm::ConstantExpr::getBitCast(sd->ir.irStruct->init, initpt);
+        LLConstant* cicast = llvm::ConstantExpr::getBitCast(sd->ir.irStruct->getInitSymbol(), initpt);
         sinits.push_back(DtoConstSlice(DtoConstSize_t(cisize), cicast));
     }
 
@@ -857,7 +843,7 @@
     // initializer vector
     std::vector<LLConstant*> sinits;
     // first is always the vtable
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -865,9 +851,10 @@
     // get classinfo
     assert(tinfo->ty == Tclass);
     TypeClass *tc = (TypeClass *)tinfo;
-    tc->sym->codegen(Type::sir);;
-    assert(tc->sym->ir.irStruct->classInfo);
-    sinits.push_back(tc->sym->ir.irStruct->classInfo);
+
+    tc->sym->codegen(Type::sir);
+
+    sinits.push_back(tc->sym->ir.irStruct->getClassInfoSymbol());
 
     // create the inititalizer
     LLConstant* tiInit = llvm::ConstantStruct::get(sinits);
@@ -897,7 +884,7 @@
     // initializer vector
     std::vector<LLConstant*> sinits;
     // first is always the vtable
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));
@@ -905,8 +892,8 @@
     // get classinfo
     assert(tinfo->ty == Tclass);
     TypeClass *tc = (TypeClass *)tinfo;
-    assert(tc->sym->ir.irStruct->classInfo);
-    sinits.push_back(tc->sym->ir.irStruct->classInfo);
+
+    sinits.push_back(tc->sym->ir.irStruct->getClassInfoSymbol());
 
     // create the inititalizer
     LLConstant* tiInit = llvm::ConstantStruct::get(sinits);
@@ -936,7 +923,7 @@
     // initializer vector
     std::vector<LLConstant*> sinits;
     // first is always the vtable
-    sinits.push_back(base->ir.irStruct->vtbl);
+    sinits.push_back(base->ir.irStruct->getVtblSymbol());
 
     // monitor
     sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(LLType::Int8Ty)));