mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Improve ResolveFunctions to:
a) use better local variable names (OldMT -> OldFT) where "M" is used to mean "Function" (perhaps it was previously "Method"?) b) print out the module identifier in a warning message so that it is possible to track down in which module the error occurred. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24698 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
86cb643801
commit
2f1890792c
@ -55,11 +55,11 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
|
|||||||
for (unsigned i = 0; i != Globals.size(); ++i)
|
for (unsigned i = 0; i != Globals.size(); ++i)
|
||||||
if (Globals[i] != Concrete) {
|
if (Globals[i] != Concrete) {
|
||||||
Function *Old = cast<Function>(Globals[i]);
|
Function *Old = cast<Function>(Globals[i]);
|
||||||
const FunctionType *OldMT = Old->getFunctionType();
|
const FunctionType *OldFT = Old->getFunctionType();
|
||||||
const FunctionType *ConcreteMT = Concrete->getFunctionType();
|
const FunctionType *ConcreteFT = Concrete->getFunctionType();
|
||||||
|
|
||||||
if (OldMT->getNumParams() > ConcreteMT->getNumParams() &&
|
if (OldFT->getNumParams() > ConcreteFT->getNumParams() &&
|
||||||
!ConcreteMT->isVarArg())
|
!ConcreteFT->isVarArg())
|
||||||
if (!Old->use_empty()) {
|
if (!Old->use_empty()) {
|
||||||
std::cerr << "WARNING: Linking function '" << Old->getName()
|
std::cerr << "WARNING: Linking function '" << Old->getName()
|
||||||
<< "' is causing arguments to be dropped.\n";
|
<< "' is causing arguments to be dropped.\n";
|
||||||
@ -73,20 +73,22 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
|
|||||||
// Check to make sure that if there are specified types, that they
|
// Check to make sure that if there are specified types, that they
|
||||||
// match...
|
// match...
|
||||||
//
|
//
|
||||||
unsigned NumArguments = std::min(OldMT->getNumParams(),
|
unsigned NumArguments = std::min(OldFT->getNumParams(),
|
||||||
ConcreteMT->getNumParams());
|
ConcreteFT->getNumParams());
|
||||||
|
|
||||||
if (!Old->use_empty() && !Concrete->use_empty())
|
if (!Old->use_empty() && !Concrete->use_empty())
|
||||||
for (unsigned i = 0; i < NumArguments; ++i)
|
for (unsigned i = 0; i < NumArguments; ++i)
|
||||||
if (OldMT->getParamType(i) != ConcreteMT->getParamType(i))
|
if (OldFT->getParamType(i) != ConcreteFT->getParamType(i))
|
||||||
if (OldMT->getParamType(i)->getTypeID() !=
|
if (OldFT->getParamType(i)->getTypeID() !=
|
||||||
ConcreteMT->getParamType(i)->getTypeID()) {
|
ConcreteFT->getParamType(i)->getTypeID()) {
|
||||||
std::cerr << "WARNING: Function [" << Old->getName()
|
std::cerr << "WARNING: Function [" << Old->getName()
|
||||||
<< "]: Parameter types conflict for: '";
|
<< "]: Parameter types conflict for: '";
|
||||||
WriteTypeSymbolic(std::cerr, OldMT, &M);
|
WriteTypeSymbolic(std::cerr, OldFT, &M);
|
||||||
std::cerr << "' and '";
|
std::cerr << "' (in "
|
||||||
WriteTypeSymbolic(std::cerr, ConcreteMT, &M);
|
<< Old->getParent()->getModuleIdentifier() << ") and '";
|
||||||
std::cerr << "'\n";
|
WriteTypeSymbolic(std::cerr, ConcreteFT, &M);
|
||||||
|
std::cerr << "'(in "
|
||||||
|
<< Concrete->getParent()->getModuleIdentifier() << ")\n";
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user