Changes in directory llvm/lib/Transforms/Utils:
CloneModule.cpp updated: 1.17 -> 1.18 --- Log message: Add a CloneModule call that exposes the mapping of values from the old module to the new module. Patch provided by Nick Lewycky! --- Diffs of the changes: (+8 -4) CloneModule.cpp | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/CloneModule.cpp diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.17 llvm/lib/Transforms/Utils/CloneModule.cpp:1.18 --- llvm/lib/Transforms/Utils/CloneModule.cpp:1.17 Mon Jan 23 22:16:34 2006 +++ llvm/lib/Transforms/Utils/CloneModule.cpp Wed May 17 13:05:35 2006 @@ -26,6 +26,14 @@ /// respectively) refer to the right globals. /// Module *llvm::CloneModule(const Module *M) { + // Create the value map that maps things from the old module over to the new + // module. + std::map<const Value*, Value*> ValueMap; + + return CloneModule(M, ValueMap); +} + +Module *llvm::CloneModule(const Module *M, std::map<const Value*, Value*> &ValueMap) { // First off, we need to create the new module... Module *New = new Module(M->getModuleIdentifier()); New->setEndianness(M->getEndianness()); @@ -44,10 +52,6 @@ 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. - std::map<const Value*, Value*> ValueMap; - // Loop over all of the global variables, making corresponding globals in the // new module. Here we add them to the ValueMap and to the new Module. We // don't worry about attributes or initializers, they will come later. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits