summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CloneModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-16 20:28:45 +0000
committerChris Lattner <sabre@nondot.org>2003-04-16 20:28:45 +0000
commit379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89 (patch)
tree76f2336957b62005e10d223d5493eda780e27cef /llvm/lib/Transforms/Utils/CloneModule.cpp
parentf0e92b575f675ee8fb09b7fdb56cc27e8a5bdd21 (diff)
downloadbcm5719-llvm-379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89.tar.gz
bcm5719-llvm-379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89.zip
Add new linkage types to support a real frontend
llvm-svn: 5786
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneModule.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp
index 043e06d5437..223e3fd88cd 100644
--- a/llvm/lib/Transforms/Utils/CloneModule.cpp
+++ b/llvm/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<FunctionType>(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<Constant>(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;
OpenPOWER on IntegriCloud