diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-02-18 19:05:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-02-18 19:05:15 +0000 |
| commit | ccb9e604def85483faf0fe0f350537239ea52a1a (patch) | |
| tree | 0865f886a12fb1df5633fcce0232f042ecf40161 /llvm/lib | |
| parent | 278dfafab278ea804b51f53c4e409b8eb88c4b7c (diff) | |
| download | bcm5719-llvm-ccb9e604def85483faf0fe0f350537239ea52a1a.tar.gz bcm5719-llvm-ccb9e604def85483faf0fe0f350537239ea52a1a.zip | |
Handle more cases in the linker
llvm-svn: 1771
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/IPO/DeadTypeElimination.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp index 7ec2b6faa83..09d8db4eb85 100644 --- a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -130,8 +130,7 @@ bool CleanupGCCOutput::PatchUpMethodReferences(Module *M) { } } - if (Methods[i] && (!Methods[i]->getMethodType()->isVarArg() || - Methods[i]->getMethodType()->getParamTypes().size())) { + if (Methods[i] && (!Methods[i]->getMethodType()->isVarArg())) { if (Concrete) { // Found two different methods types. Can't choose Concrete = 0; break; @@ -158,11 +157,28 @@ bool CleanupGCCOutput::PatchUpMethodReferences(Module *M) { for (unsigned i = 0; i < Methods.size(); ++i) if (Methods[i] != Concrete) { Method *Old = Methods[i]; + const MethodType *OldMT = Old->getMethodType(); + const MethodType *ConcreteMT = Concrete->getMethodType(); + bool Broken = false; + assert(Old->getReturnType() == Concrete->getReturnType() && "Differing return types not handled yet!"); - assert(Old->getMethodType()->getParamTypes().size() == 0 && - "Cannot handle varargs fn's with specified element types!"); - + assert(OldMT->getParamTypes().size() <= + ConcreteMT->getParamTypes().size() && + "Concrete type must have more specified parameters!"); + + // Check to make sure that if there are specified types, that they + // match... + // + for (unsigned i = 0; i < OldMT->getParamTypes().size(); ++i) + if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i]) { + cerr << "Parameter types conflict for" << OldMT + << " and " << ConcreteMT; + Broken = true; + } + if (Broken) break; // Can't process this one! + + // Attempt to convert all of the uses of the old method to the // concrete form of the method. If there is a use of the method // that we don't understand here we punt to avoid making a bad |

