[PATCH] [ExecutionEngine] FindFunctionNamed: Skip declarations

Keno Fischer kfischer at college.harvard.edu
Tue Jan 20 09:21:46 PST 2015


Same change in the overridden method in MCJIT.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7068

Files:
  lib/ExecutionEngine/ExecutionEngine.cpp
  lib/ExecutionEngine/MCJIT/MCJIT.cpp

Index: lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- lib/ExecutionEngine/ExecutionEngine.cpp
+++ lib/ExecutionEngine/ExecutionEngine.cpp
@@ -137,7 +137,8 @@
 
 Function *ExecutionEngine::FindFunctionNamed(const char *FnName) {
   for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
-    if (Function *F = Modules[i]->getFunction(FnName))
+    Function *F = Modules[i]->getFunction(FnName);
+    if (F && !F->isDeclaration())
       return F;
   }
   return nullptr;
Index: lib/ExecutionEngine/MCJIT/MCJIT.cpp
===================================================================
--- lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -410,7 +410,8 @@
                                                  ModulePtrSet::iterator I,
                                                  ModulePtrSet::iterator E) {
   for (; I != E; ++I) {
-    if (Function *F = (*I)->getFunction(FnName))
+    Function *F = (*I)->getFunction(FnName);
+    if (F && !F->isDeclaration())
       return F;
   }
   return nullptr;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7068.18441.patch
Type: text/x-patch
Size: 1098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150120/938f142c/attachment.bin>


More information about the llvm-commits mailing list