[PATCH] [ExecutionEngine] FindFunctionNamed: Skip declarations

Keno Fischer kfischer at college.harvard.edu
Tue Jan 20 08:28:33 PST 2015


Hi lhames,

Basically all other methods that look up functions by name skip them if they are mere declarations.
Do the same in FindFunctionNamed.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7068

Files:
  lib/ExecutionEngine/ExecutionEngine.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;

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


More information about the llvm-commits mailing list