summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-18 21:32:45 +0000
committerChris Lattner <sabre@nondot.org>2006-01-18 21:32:45 +0000
commitc4e8c9f318a4cb9ff75d8955482a8ca6412803cd (patch)
treef28e7a2ad9697ddfe8d59c301307f09db6dd0d1e /lib/Transforms/Utils/CloneModule.cpp
parentbc38dbfd9b88c021378c647f6c169f4f76a775da (diff)
downloadllvm-c4e8c9f318a4cb9ff75d8955482a8ca6412803cd.tar.gz
llvm-c4e8c9f318a4cb9ff75d8955482a8ca6412803cd.tar.bz2
llvm-c4e8c9f318a4cb9ff75d8955482a8ca6412803cd.tar.xz
Make sure that cloning a module clones its target triple and dependent
library list as well. This should help bugpoint. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index 309b280cc0..324e00aaa8 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -30,14 +30,18 @@ Module *llvm::CloneModule(const Module *M) {
Module *New = new Module(M->getModuleIdentifier());
New->setEndianness(M->getEndianness());
New->setPointerSize(M->getPointerSize());
+ New->setTargetTriple(M->getTargetTriple());
- // Copy all of the type symbol table entries over...
+ // Copy all of the type symbol table entries over.
const SymbolTable &SymTab = M->getSymbolTable();
SymbolTable::type_const_iterator TypeI = SymTab.type_begin();
SymbolTable::type_const_iterator TypeE = SymTab.type_end();
- for ( ; TypeI != TypeE; ++TypeI ) {
+ for (; TypeI != TypeE; ++TypeI)
New->addTypeName(TypeI->first, TypeI->second);
- }
+
+ // Copy all of the dependent libraries over.
+ for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
+ New->addLibrary(*I);
// Create the value map that maps things from the old module over to the new
// module.