diff options
| author | Chris Lattner <sabre@nondot.org> | 2001-10-23 20:43:42 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2001-10-23 20:43:42 +0000 | 
| commit | b046867a9796d1ab3a85cb4527cc9521c856ed75 (patch) | |
| tree | e7c36ee9d193c4666284d5d5d5526f993a568b8b /llvm/lib | |
| parent | aeaec1ccb98c3dbae6bd7417eb0aa9a1ab42840e (diff) | |
| download | bcm5719-llvm-b046867a9796d1ab3a85cb4527cc9521c856ed75.tar.gz bcm5719-llvm-b046867a9796d1ab3a85cb4527cc9521c856ed75.zip | |
Fix problem linking in a method prototype when a method body exists
llvm-svn: 965
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Utils/Linker.cpp | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/llvm/lib/Transforms/Utils/Linker.cpp b/llvm/lib/Transforms/Utils/Linker.cpp index 33acbb4afb2..55023b82bf9 100644 --- a/llvm/lib/Transforms/Utils/Linker.cpp +++ b/llvm/lib/Transforms/Utils/Linker.cpp @@ -294,12 +294,20 @@ static bool LinkMethodBodies(Module *Dest, const Module *Src,    // Loop over all of the methods in the src module, mapping them over as we go    //    for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) { -    const Method *SM = *I;                   // Source Method -    Method *DM = cast<Method>(ValueMap[SM]); // Destination method +    const Method *SM = *I;                     // Source Method +    if (!SM->isExternal()) {                   // No body if method is external +      Method *DM = cast<Method>(ValueMap[SM]); // Destination method + +      // DM not external SM external? +      if (!DM->isExternal()) { +        if (Err) +          *Err = "Method '" + (SM->hasName() ? SM->getName() : string("")) + +                 "' body multiply defined!"; +        return true; +      } -    assert(DM && DM->isExternal() && "LinkMethodProtos failed!"); -    if (!SM->isExternal())  // External methods are already done        if (LinkMethodBody(DM, SM, ValueMap, Err)) return true; +    }    }    return false;  } | 

