CloneModule.cpp (198090) | CloneModule.cpp (198892) |
---|---|
1//===- CloneModule.cpp - Clone an entire module ---------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 75 unchanged lines hidden (view full) --- 84 // have been created, loop through and copy the global variable referrers 85 // over... We also set the attributes on the global now. 86 // 87 for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); 88 I != E; ++I) { 89 GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]); 90 if (I->hasInitializer()) 91 GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(), | 1//===- CloneModule.cpp - Clone an entire module ---------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 75 unchanged lines hidden (view full) --- 84 // have been created, loop through and copy the global variable referrers 85 // over... We also set the attributes on the global now. 86 // 87 for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); 88 I != E; ++I) { 89 GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]); 90 if (I->hasInitializer()) 91 GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(), |
92 ValueMap, 93 M->getContext()))); | 92 ValueMap))); |
94 GV->setLinkage(I->getLinkage()); 95 GV->setThreadLocal(I->isThreadLocal()); 96 GV->setConstant(I->isConstant()); 97 } 98 99 // Similarly, copy over function bodies now... 100 // 101 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) { --- 14 unchanged lines hidden (view full) --- 116 } 117 118 // And aliases 119 for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); 120 I != E; ++I) { 121 GlobalAlias *GA = cast<GlobalAlias>(ValueMap[I]); 122 GA->setLinkage(I->getLinkage()); 123 if (const Constant* C = I->getAliasee()) | 93 GV->setLinkage(I->getLinkage()); 94 GV->setThreadLocal(I->isThreadLocal()); 95 GV->setConstant(I->isConstant()); 96 } 97 98 // Similarly, copy over function bodies now... 99 // 100 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) { --- 14 unchanged lines hidden (view full) --- 115 } 116 117 // And aliases 118 for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); 119 I != E; ++I) { 120 GlobalAlias *GA = cast<GlobalAlias>(ValueMap[I]); 121 GA->setLinkage(I->getLinkage()); 122 if (const Constant* C = I->getAliasee()) |
124 GA->setAliasee(cast<Constant>(MapValue(C, ValueMap, M->getContext()))); | 123 GA->setAliasee(cast |
125 } 126 127 return New; 128} | 124 } 125 126 return New; 127} |