simplify name juggling through the use of Value::takeName.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34175 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-02-11 01:08:35 +00:00
parent f41916e75d
commit 046800a712
6 changed files with 23 additions and 34 deletions

View File

@ -90,16 +90,15 @@ namespace {
for (Module::iterator I = M.begin(); ; ++I) {
if (&*I != Named) {
Function *New = new Function(I->getFunctionType(),
GlobalValue::ExternalLinkage,
I->getName());
GlobalValue::ExternalLinkage);
New->setCallingConv(I->getCallingConv());
I->setName(""); // Remove Old name
// If it's not the named function, delete the body of the function
I->dropAllReferences();
M.getFunctionList().push_back(New);
NewFunctions.push_back(New);
New->takeName(I);
}
if (&*I == Last) break; // Stop after processing the last function