if (std::find(Named.begin(), Named.end(), &*I) == Named.end()) {
Function *New = Function::Create(I->getFunctionType(),
GlobalValue::ExternalLinkage);
- New->setCallingConv(I->getCallingConv());
- New->setParamAttrs(I->getParamAttrs());
- if (I->hasCollector())
- New->setCollector(I->getCollector());
+ New->copyAttributesFrom(I);
// If it's not the named function, delete the body of the function
I->dropAllReferences();