1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Make sure that the cloned module retains the type symbol table entries!

llvm-svn: 5894
This commit is contained in:
Chris Lattner 2003-04-24 17:15:33 +00:00
parent 0b66fe7194
commit f0c01a508b

View File

@ -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;