one function of the same name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7274
91177308-0d34-0410-b5e6-
96231b3b80d8
///
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...
}