From 28c3cff8250b3fe2adc6479306fe7dbdb48a1bdb Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 26 May 2008 19:58:59 +0000 Subject: Factor code to copy global value attributes like the section or the visibility from one global value to another: copyAttributesFrom. This is particularly useful for duplicating functions: previously this was done by explicitly copying each attribute in turn at each place where a new function was created out of an old one, with the result that obscure attributes were regularly forgotten (like the collector or the section). Hopefully now everything is uniform and nothing is forgotten. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51567 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/CloneModule.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/Transforms/Utils/CloneModule.cpp') diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index e75f915cb9..c94c531b01 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -65,10 +65,7 @@ Module *llvm::CloneModule(const Module *M, Function *NF = Function::Create(cast(I->getType()->getElementType()), GlobalValue::ExternalLinkage, I->getName(), New); - NF->setCallingConv(I->getCallingConv()); - NF->setParamAttrs(I->getParamAttrs()); - if (I->hasCollector()) - NF->setCollector(I->getCollector()); + NF->copyAttributesFrom(I); ValueMap[I]= NF; } -- cgit v1.2.3-18-g5258