diff gen/runtime.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 fd32135dca3e
children 1700239cab2e
line wrap: on
line diff
--- a/gen/runtime.cpp	Wed Nov 14 20:18:01 2007 +0100
+++ b/gen/runtime.cpp	Wed Nov 14 23:39:10 2007 +0100
@@ -61,9 +61,6 @@
 
 llvm::Function* LLVM_D_GetRuntimeFunction(llvm::Module* target, const char* name)
 {
-    // TODO maybe check the target module first, to allow overriding the runtime on a pre module basis?
-    // could be done and seems like it could be neat too :)
-
     if (global.params.noruntime) {
         error("No implicit runtime calls allowed with -noruntime option enabled");
         fatal();
@@ -74,10 +71,14 @@
         LLVM_D_InitRuntime();
     }
 
-    llvm::Function* fn = M->getFunction(name);
+    llvm::Function* fn = target->getFunction(name);
+    if (fn)
+        return fn;
+
+    fn = M->getFunction(name);
     if (!fn) {
-        error("Runtime function '%s' was not found", name);
-        fatal();
+        printf("Runtime function '%s' was not found\n", name);
+        assert(0);
         //return NULL;
     }