diff options
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 28e4f96..8297d15 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -151,8 +151,8 @@ bool ExecutionEngine::removeModule(Module *M) { } Function *ExecutionEngine::FindFunctionNamed(StringRef FnName) { - for (unsigned i = 0, e = Modules.size(); i != e; ++i) { - Function *F = Modules[i]->getFunction(FnName); + for (const auto &M : Modules) { + Function *F = M->getFunction(FnName); if (F && !F->isDeclaration()) return F; } @@ -160,8 +160,8 @@ Function *ExecutionEngine::FindFunctionNamed(StringRef FnName) { } GlobalVariable *ExecutionEngine::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) { - for (unsigned i = 0, e = Modules.size(); i != e; ++i) { - GlobalVariable *GV = Modules[i]->getGlobalVariable(Name,AllowInternal); + for (const auto &M : Modules) { + GlobalVariable *GV = M->getGlobalVariable(Name, AllowInternal); if (GV && !GV->isDeclaration()) return GV; } @@ -314,8 +314,8 @@ const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) { if (I != EEState.getGlobalAddressReverseMap().end()) { StringRef Name = I->second; - for (unsigned i = 0, e = Modules.size(); i != e; ++i) - if (GlobalValue *GV = Modules[i]->getNamedValue(Name)) + for (const auto &M : Modules) + if (GlobalValue *GV = M->getNamedValue(Name)) return GV; } return nullptr; @@ -1219,9 +1219,8 @@ void ExecutionEngine::emitGlobals() { const GlobalValue*> LinkedGlobalsMap; if (Modules.size() != 1) { - for (unsigned m = 0, e = Modules.size(); m != e; ++m) { - Module &M = *Modules[m]; - for (const auto &GV : M.globals()) { + for (const auto &M : Modules) { + for (const auto &GV : M->globals()) { if (GV.hasLocalLinkage() || GV.isDeclaration() || GV.hasAppendingLinkage() || !GV.hasName()) continue;// Ignore external globals and globals with internal linkage. @@ -1249,9 +1248,8 @@ void ExecutionEngine::emitGlobals() { } std::vector<const GlobalValue*> NonCanonicalGlobals; - for (unsigned m = 0, e = Modules.size(); m != e; ++m) { - Module &M = *Modules[m]; - for (const auto &GV : M.globals()) { + for (const auto &M : Modules) { + for (const auto &GV : M->globals()) { // In the multi-module case, see what this global maps to. if (!LinkedGlobalsMap.empty()) { if (const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair( @@ -1293,7 +1291,7 @@ void ExecutionEngine::emitGlobals() { // Now that all of the globals are set up in memory, loop through them all // and initialize their contents. - for (const auto &GV : M.globals()) { + for (const auto &GV : M->globals()) { if (!GV.isDeclaration()) { if (!LinkedGlobalsMap.empty()) { if (const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair( |