mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-19 04:31:17 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e306d94782
commit
7f20ea7d7b
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user