@@ -151,17 +151,17 @@ bool ExecutionEngine::removeModule(Module *M) {
151
151
}
152
152
153
153
Function *ExecutionEngine::FindFunctionNamed (StringRef FnName) {
154
- for (unsigned i = 0 , e = Modules. size (); i != e; ++i ) {
155
- Function *F = Modules[i] ->getFunction (FnName);
154
+ for (const auto &M : Modules) {
155
+ Function *F = M ->getFunction (FnName);
156
156
if (F && !F->isDeclaration ())
157
157
return F;
158
158
}
159
159
return nullptr ;
160
160
}
161
161
162
162
GlobalVariable *ExecutionEngine::FindGlobalVariableNamed (StringRef Name, bool AllowInternal) {
163
- for (unsigned i = 0 , e = Modules. size (); i != e; ++i ) {
164
- GlobalVariable *GV = Modules[i] ->getGlobalVariable (Name,AllowInternal);
163
+ for (const auto &M : Modules) {
164
+ GlobalVariable *GV = M ->getGlobalVariable (Name, AllowInternal);
165
165
if (GV && !GV->isDeclaration ())
166
166
return GV;
167
167
}
@@ -314,8 +314,8 @@ const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) {
314
314
315
315
if (I != EEState.getGlobalAddressReverseMap ().end ()) {
316
316
StringRef Name = I->second ;
317
- for (unsigned i = 0 , e = Modules. size (); i != e; ++i )
318
- if (GlobalValue *GV = Modules[i] ->getNamedValue (Name))
317
+ for (const auto &M : Modules)
318
+ if (GlobalValue *GV = M ->getNamedValue (Name))
319
319
return GV;
320
320
}
321
321
return nullptr ;
@@ -1219,9 +1219,8 @@ void ExecutionEngine::emitGlobals() {
1219
1219
const GlobalValue*> LinkedGlobalsMap;
1220
1220
1221
1221
if (Modules.size () != 1 ) {
1222
- for (unsigned m = 0 , e = Modules.size (); m != e; ++m) {
1223
- Module &M = *Modules[m];
1224
- for (const auto &GV : M.globals ()) {
1222
+ for (const auto &M : Modules) {
1223
+ for (const auto &GV : M->globals ()) {
1225
1224
if (GV.hasLocalLinkage () || GV.isDeclaration () ||
1226
1225
GV.hasAppendingLinkage () || !GV.hasName ())
1227
1226
continue ;// Ignore external globals and globals with internal linkage.
@@ -1249,9 +1248,8 @@ void ExecutionEngine::emitGlobals() {
1249
1248
}
1250
1249
1251
1250
std::vector<const GlobalValue*> NonCanonicalGlobals;
1252
- for (unsigned m = 0 , e = Modules.size (); m != e; ++m) {
1253
- Module &M = *Modules[m];
1254
- for (const auto &GV : M.globals ()) {
1251
+ for (const auto &M : Modules) {
1252
+ for (const auto &GV : M->globals ()) {
1255
1253
// In the multi-module case, see what this global maps to.
1256
1254
if (!LinkedGlobalsMap.empty ()) {
1257
1255
if (const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair (
@@ -1293,7 +1291,7 @@ void ExecutionEngine::emitGlobals() {
1293
1291
1294
1292
// Now that all of the globals are set up in memory, loop through them all
1295
1293
// and initialize their contents.
1296
- for (const auto &GV : M. globals ()) {
1294
+ for (const auto &GV : M-> globals ()) {
1297
1295
if (!GV.isDeclaration ()) {
1298
1296
if (!LinkedGlobalsMap.empty ()) {
1299
1297
if (const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair (
0 commit comments