mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +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,14 +405,16 @@ 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())
|
||||||
std::map<std::string, GlobalValue*>::iterator EGV =
|
if (!(DGV = Dest->getGlobalVariable(SGV->getName(),
|
||||||
GlobalsByName.find(SGV->getName());
|
SGV->getType()->getElementType()))) {
|
||||||
if (EGV != GlobalsByName.end())
|
std::map<std::string, GlobalValue*>::iterator EGV =
|
||||||
DGV = dyn_cast<GlobalVariable>(EGV->second);
|
GlobalsByName.find(SGV->getName());
|
||||||
if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(), ST, ""))
|
if (EGV != GlobalsByName.end())
|
||||||
DGV = 0; // FIXME: gross.
|
DGV = dyn_cast<GlobalVariable>(EGV->second);
|
||||||
}
|
if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(), ST, ""))
|
||||||
|
DGV = 0; // FIXME: gross.
|
||||||
|
}
|
||||||
|
|
||||||
assert(SGV->hasInitializer() || SGV->hasExternalLinkage() &&
|
assert(SGV->hasInitializer() || SGV->hasExternalLinkage() &&
|
||||||
"Global must either be external or have an initializer!");
|
"Global must either be external or have an initializer!");
|
||||||
@ -587,12 +588,14 @@ 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.
|
||||||
std::map<std::string, GlobalValue*>::iterator EF =
|
if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) {
|
||||||
GlobalsByName.find(SF->getName());
|
std::map<std::string, GlobalValue*>::iterator EF =
|
||||||
if (EF != GlobalsByName.end())
|
GlobalsByName.find(SF->getName());
|
||||||
DF = dyn_cast<Function>(EF->second);
|
if (EF != GlobalsByName.end())
|
||||||
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
DF = dyn_cast<Function>(EF->second);
|
||||||
DF = 0; // FIXME: gross.
|
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
||||||
|
DF = 0; // FIXME: gross.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
||||||
|
@ -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,14 +405,16 @@ 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())
|
||||||
std::map<std::string, GlobalValue*>::iterator EGV =
|
if (!(DGV = Dest->getGlobalVariable(SGV->getName(),
|
||||||
GlobalsByName.find(SGV->getName());
|
SGV->getType()->getElementType()))) {
|
||||||
if (EGV != GlobalsByName.end())
|
std::map<std::string, GlobalValue*>::iterator EGV =
|
||||||
DGV = dyn_cast<GlobalVariable>(EGV->second);
|
GlobalsByName.find(SGV->getName());
|
||||||
if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(), ST, ""))
|
if (EGV != GlobalsByName.end())
|
||||||
DGV = 0; // FIXME: gross.
|
DGV = dyn_cast<GlobalVariable>(EGV->second);
|
||||||
}
|
if (DGV && RecursiveResolveTypes(SGV->getType(), DGV->getType(), ST, ""))
|
||||||
|
DGV = 0; // FIXME: gross.
|
||||||
|
}
|
||||||
|
|
||||||
assert(SGV->hasInitializer() || SGV->hasExternalLinkage() &&
|
assert(SGV->hasInitializer() || SGV->hasExternalLinkage() &&
|
||||||
"Global must either be external or have an initializer!");
|
"Global must either be external or have an initializer!");
|
||||||
@ -587,12 +588,14 @@ 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.
|
||||||
std::map<std::string, GlobalValue*>::iterator EF =
|
if (!(DF = Dest->getFunction(SF->getName(), SF->getFunctionType()))) {
|
||||||
GlobalsByName.find(SF->getName());
|
std::map<std::string, GlobalValue*>::iterator EF =
|
||||||
if (EF != GlobalsByName.end())
|
GlobalsByName.find(SF->getName());
|
||||||
DF = dyn_cast<Function>(EF->second);
|
if (EF != GlobalsByName.end())
|
||||||
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
DF = dyn_cast<Function>(EF->second);
|
||||||
DF = 0; // FIXME: gross.
|
if (DF && RecursiveResolveTypes(SF->getType(), DF->getType(), ST, ""))
|
||||||
|
DF = 0; // FIXME: gross.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
if (!DF || SF->hasInternalLinkage() || DF->hasInternalLinkage()) {
|
||||||
|
Reference in New Issue
Block a user