[llvm-commits] CVS: llvm/lib/VMCore/Module.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Jul 23 15:22:01 PDT 2003
Changes in directory llvm/lib/VMCore:
Module.cpp updated: 1.36 -> 1.37
---
Log message:
Make Module::getNamedFunction prefer non-external functions if there is more than
one function of the same name
---
Diffs of the changes:
Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.36 llvm/lib/VMCore/Module.cpp:1.37
--- llvm/lib/VMCore/Module.cpp:1.36 Thu May 15 14:37:21 2003
+++ llvm/lib/VMCore/Module.cpp Wed Jul 23 15:21:30 2003
@@ -172,10 +172,14 @@
///
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...
}
More information about the llvm-commits
mailing list