[pkg-d-commits] [ldc] 193/211: Revert "Revert "Revert "Check existing runtime function declarations for matching type"""

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 15be34086e097c40a263028dbe17b07c28c533a5
Author: Martin <noone at nowhere.com>
Date:   Fri Nov 18 22:02:11 2016 +0100

    Revert "Revert "Revert "Check existing runtime function declarations for matching type"""
    
    This reverts commit d7b45f7c7d906d09200698399a9418aef08a774c.
---
 gen/runtime.cpp | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/gen/runtime.cpp b/gen/runtime.cpp
index cf86cf4..73ff0b7 100644
--- a/gen/runtime.cpp
+++ b/gen/runtime.cpp
@@ -132,24 +132,22 @@ llvm::Function *getRuntimeFunction(const Loc &loc, llvm::Module &target,
                                    const char *name) {
   checkForImplicitGCCall(loc, name);
 
-  if (!M)
+  if (!M) {
     initRuntime();
+  }
 
-  LLFunction *fn = M->getFunction(name);
+  LLFunction *fn = target.getFunction(name);
+  if (fn) {
+    return fn;
+  }
+
+  fn = M->getFunction(name);
   if (!fn) {
     error(loc, "Runtime function '%s' was not found", name);
     fatal();
   }
-  LLFunctionType *fnty = fn->getFunctionType();
-
-  if (LLFunction *existing = target.getFunction(name)) {
-    if (existing->getFunctionType() != fnty) {
-      error(Loc(), "Incompatible declaration of runtime function '%s'", name);
-      fatal();
-    }
-    return existing;
-  }
 
+  LLFunctionType *fnty = fn->getFunctionType();
   LLFunction *resfn =
       llvm::cast<llvm::Function>(target.getOrInsertFunction(name, fnty));
   resfn->setAttributes(fn->getAttributes());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list