diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-24 17:15:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-24 17:15:33 +0000 |
commit | 892310eaff9eb8439029755ddf84c2f22f0b7dd7 (patch) | |
tree | 0af0eb97eb65d63c735f970f4f5a9869b31e0289 /lib/Transforms/Utils/CloneModule.cpp | |
parent | 640f22e66d90439857a97a83896ee68c4f7128c9 (diff) |
Make sure that the cloned module retains the type symbol table entries!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5894 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r-- | lib/Transforms/Utils/CloneModule.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index 992431619c..93bed75839 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -8,6 +8,7 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" +#include "llvm/SymbolTable.h" #include "llvm/Constant.h" #include "ValueMapper.h" @@ -22,6 +23,14 @@ Module *CloneModule(const Module *M) { New->setEndianness(M->getEndianness()); New->setPointerSize(M->getPointerSize()); + // Copy all of the type symbol table entries over... + const SymbolTable &SymTab = M->getSymbolTable(); + SymbolTable::const_iterator TypeI = SymTab.find(Type::TypeTy); + if (TypeI != SymTab.end()) + for (SymbolTable::VarMap::const_iterator I = TypeI->second.begin(), + E = TypeI->second.end(); I != E; ++I) + New->addTypeName(I->first, cast<Type>(I->second)); + // Create the value map that maps things from the old module over to the new // module. std::map<const Value*, Value*> ValueMap; |