mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-16 00:33:10 +00:00
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
This commit is contained in:
parent
640f22e66d
commit
892310eaff
@ -8,6 +8,7 @@
|
|||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
|
#include "llvm/SymbolTable.h"
|
||||||
#include "llvm/Constant.h"
|
#include "llvm/Constant.h"
|
||||||
#include "ValueMapper.h"
|
#include "ValueMapper.h"
|
||||||
|
|
||||||
@ -22,6 +23,14 @@ Module *CloneModule(const Module *M) {
|
|||||||
New->setEndianness(M->getEndianness());
|
New->setEndianness(M->getEndianness());
|
||||||
New->setPointerSize(M->getPointerSize());
|
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
|
// Create the value map that maps things from the old module over to the new
|
||||||
// module.
|
// module.
|
||||||
std::map<const Value*, Value*> ValueMap;
|
std::map<const Value*, Value*> ValueMap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user