summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-18 03:01:24 +0000
committerChris Lattner <sabre@nondot.org>2002-07-18 03:01:24 +0000
commit72f9a86d1e2e305b2d2a7c48416e0cf1dd466b5a (patch)
treeda78df5d02478eace8a4ec9e4fa82e23e6c825ba /llvm/lib/Transforms/IPO/FunctionResolution.cpp
parentf0cfe654d7615e67ce36511f72a0b895be842261 (diff)
downloadbcm5719-llvm-72f9a86d1e2e305b2d2a7c48416e0cf1dd466b5a.tar.gz
bcm5719-llvm-72f9a86d1e2e305b2d2a7c48416e0cf1dd466b5a.zip
Only functions with external linkage can be resolved to function declarations.
This change fixes programs that have multiple functions named the same thing, where are least one of them is static/internal. llvm-svn: 2954
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionResolution.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionResolution.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionResolution.cpp b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
index 6cb901b79fe..683512689e3 100644
--- a/llvm/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
@@ -122,8 +122,11 @@ bool FunctionResolvingPass::run(Module &M) {
SymbolTable::VarMap &Plane = I->second;
for (SymbolTable::type_iterator PI = Plane.begin(), PE = Plane.end();
PI != PE; ++PI) {
- const string &Name = PI->first;
- Functions[Name].push_back(cast<Function>(PI->second));
+ Function *F = cast<Function>(PI->second);
+ assert(PI->first == F->getName() &&
+ "Function name and symbol table do not agree!");
+ if (F->hasExternalLinkage()) // Only resolve decls to external fns
+ Functions[PI->first].push_back(F);
}
}
@@ -139,6 +142,7 @@ bool FunctionResolvingPass::run(Module &M) {
Function *Concrete = 0;
for (unsigned i = 0; i < Functions.size(); ) {
if (!Functions[i]->isExternal()) { // Found an implementation
+ if (Implementation != 0)
assert(Implementation == 0 && "Multiple definitions of the same"
" function. Case not handled yet!");
Implementation = Functions[i];
OpenPOWER on IntegriCloud