aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 275d4cfbf3..abc4654da1 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -172,10 +172,14 @@ Function *Module::getMainFunction() {
///
Function *Module::getNamedFunction(const std::string &Name) {
// Loop over all of the functions, looking for the function desired
+ Function *Found = 0;
for (iterator I = begin(), E = end(); I != E; ++I)
if (I->getName() == Name)
- return I;
- return 0; // function not found...
+ if (I->isExternal())
+ Found = I;
+ else
+ return I;
+ return Found; // Non-external function not found...
}