mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-29 13:24:25 +00:00
Fix another minor problem that exists if you ahve multiple functions with
nonunifiable types but the same name. Down with PR411! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -24,7 +24,6 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Error - Simple wrapper function to conditionally assign to E and return true.
|
// Error - Simple wrapper function to conditionally assign to E and return true.
|
||||||
@ -406,7 +405,9 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
|||||||
const GlobalVariable *SGV = I;
|
const GlobalVariable *SGV = I;
|
||||||
GlobalVariable *DGV = 0;
|
GlobalVariable *DGV = 0;
|
||||||
// Check to see if may have to link the global.
|
// Check to see if may have to link the global.
|
||||||
if (SGV->hasName() && !SGV->hasInternalLinkage()) {
|
if (SGV->hasName() && !SGV->hasInternalLinkage())
|
||||||
|
if (!(DGV = Dest->getGlobalVariable(SGV->getName(),
|
||||||
|
SGV->getType()->getElementType()))) {
|
||||||
std::map<std::string, GlobalValue*>::iterator EGV =
|
std::map<std::string, GlobalValue*>::iterator EGV =
|
||||||
GlobalsByName.find(SGV->getName());
|
GlobalsByName.find(SGV->getName());
|
||||||
if (EGV != GlobalsByName.end())
|
if (EGV != GlobalsByName.end())
|
||||||
@ -587,6 +588,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
Function *DF = 0;
|
Function *DF = 0;
|
||||||
if (SF->hasName() && !SF->hasInternalLinkage()) {
|
if (SF->hasName() && !SF->hasInternalLinkage()) {
|
||||||
// Check to see if may have to link the function.
|
// Check to see if may have to link the function.
|
||||||
|
if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) {
|
||||||
std::map<std::string, GlobalValue*>::iterator EF =
|
std::map<std::string, GlobalValue*>::iterator EF =
|
||||||
GlobalsByName.find(SF->getName());
|
GlobalsByName.find(SF->getName());
|
||||||
if (EF != GlobalsByName.end())
|
if (EF != GlobalsByName.end())
|
||||||
@ -594,6 +596,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
||||||
DF = 0; // FIXME: gross.
|
DF = 0; // FIXME: gross.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
||||||
// Function does not already exist, simply insert an function signature
|
// Function does not already exist, simply insert an function signature
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Error - Simple wrapper function to conditionally assign to E and return true.
|
// Error - Simple wrapper function to conditionally assign to E and return true.
|
||||||
@ -406,7 +405,9 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
|||||||
const GlobalVariable *SGV = I;
|
const GlobalVariable *SGV = I;
|
||||||
GlobalVariable *DGV = 0;
|
GlobalVariable *DGV = 0;
|
||||||
// Check to see if may have to link the global.
|
// Check to see if may have to link the global.
|
||||||
if (SGV->hasName() && !SGV->hasInternalLinkage()) {
|
if (SGV->hasName() && !SGV->hasInternalLinkage())
|
||||||
|
if (!(DGV = Dest->getGlobalVariable(SGV->getName(),
|
||||||
|
SGV->getType()->getElementType()))) {
|
||||||
std::map<std::string, GlobalValue*>::iterator EGV =
|
std::map<std::string, GlobalValue*>::iterator EGV =
|
||||||
GlobalsByName.find(SGV->getName());
|
GlobalsByName.find(SGV->getName());
|
||||||
if (EGV != GlobalsByName.end())
|
if (EGV != GlobalsByName.end())
|
||||||
@ -587,6 +588,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
Function *DF = 0;
|
Function *DF = 0;
|
||||||
if (SF->hasName() && !SF->hasInternalLinkage()) {
|
if (SF->hasName() && !SF->hasInternalLinkage()) {
|
||||||
// Check to see if may have to link the function.
|
// Check to see if may have to link the function.
|
||||||
|
if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) {
|
||||||
std::map<std::string, GlobalValue*>::iterator EF =
|
std::map<std::string, GlobalValue*>::iterator EF =
|
||||||
GlobalsByName.find(SF->getName());
|
GlobalsByName.find(SF->getName());
|
||||||
if (EF != GlobalsByName.end())
|
if (EF != GlobalsByName.end())
|
||||||
@ -594,6 +596,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
||||||
DF = 0; // FIXME: gross.
|
DF = 0; // FIXME: gross.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
||||||
// Function does not already exist, simply insert an function signature
|
// Function does not already exist, simply insert an function signature
|
||||||
|
Reference in New Issue
Block a user