From 4ad02e726d9b634372b037d4b352d8b63bb9e849 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 16 Apr 2003 20:28:45 +0000 Subject: Add new linkage types to support a real frontend git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5786 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/CloneModule.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/Transforms/Utils/CloneModule.cpp') diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index 043e06d543..223e3fd88c 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -29,13 +29,14 @@ Module *CloneModule(const Module *M) { // don't worry about attributes or initializers, they will come later. // for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I) - ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), - false, false, 0, I->getName(), New); + ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false, + GlobalValue::ExternalLinkage, 0, + I->getName(), New); // Loop over the functions in the module, making external functions as before for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) ValueMap[I]=new Function(cast(I->getType()->getElementType()), - false, I->getName(), New); + GlobalValue::ExternalLinkage, I->getName(), New); // Now that all of the things that global variable initializer can refer to // have been created, loop through and copy the global variable referrers @@ -46,8 +47,7 @@ Module *CloneModule(const Module *M) { if (I->hasInitializer()) GV->setInitializer(cast(MapValue(I->getInitializer(), ValueMap))); - if (I->hasInternalLinkage()) - GV->setInternalLinkage(true); + GV->setLinkage(I->getLinkage()); } // Similarly, copy over function bodies now... @@ -65,8 +65,7 @@ Module *CloneModule(const Module *M) { CloneFunctionInto(F, I, ValueMap, Returns); } - if (I->hasInternalLinkage()) - F->setInternalLinkage(true); + F->setLinkage(I->getLinkage()); } return New; -- cgit v1.2.3-18-g5258