diff gen/toobj.cpp @ 98:6789050b5ad1 trunk

[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references. Now uses the DMD _adEq(void[], void[], TypeInfo) runtime function for array equality comparison.
author lindquist
date Wed, 14 Nov 2007 23:39:10 +0100
parents ce7ed8f59b99
children 5071469303d4
line wrap: on
line diff
--- a/gen/toobj.cpp	Wed Nov 14 20:18:01 2007 +0100
+++ b/gen/toobj.cpp	Wed Nov 14 23:39:10 2007 +0100
@@ -90,6 +90,14 @@
         dsym->toObjFile();
     }
 
+    // check if there are queued function definitions, if so process their bodies now
+    if (!ir.funcQueue.empty()) {
+        size_t n = ir.funcQueue.size();
+        for (size_t i=0; i<n; ++i) {
+            ir.funcQueue[i]->toObjFile();
+        }
+    }
+
     // generate ModuleInfo
     genmoduleinfo();
 
@@ -480,7 +488,8 @@
     IRStruct::FuncDeclVector& mfs = gIR->topstruct().funcs;
     size_t n = mfs.size();
     for (size_t i=0; i<n; ++i) {
-        mfs[i]->toObjFile();
+        //mfs[i]->toObjFile();
+        gIR->funcQueue.push_back(mfs[i]);
     }
 
     llvmDModule = gIR->dmodule;
@@ -693,7 +702,8 @@
         IRStruct::FuncDeclVector& mfs = gIR->topstruct().funcs;
         size_t n = mfs.size();
         for (size_t i=0; i<n; ++i) {
-            mfs[i]->toObjFile();
+            //mfs[i]->toObjFile();
+            gIR->funcQueue.push_back(mfs[i]);
         }
     }