From: Yaron Keren Date: Fri, 12 Jun 2015 20:18:20 +0000 (+0000) Subject: Rangify several for loops in ValueEnumerator constructor. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bffcf0d1c9020982015218bf7ddd3bf2003b1483;p=oota-llvm.git Rangify several for loops in ValueEnumerator constructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239636 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 6c517f5ed8d..74d4dd89bb4 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -291,44 +291,40 @@ ValueEnumerator::ValueEnumerator(const Module &M, UseListOrders = predictUseListOrder(M); // Enumerate the global variables. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) - EnumerateValue(I); + for (const GlobalVariable &GV : M.globals()) + EnumerateValue(&GV); // Enumerate the functions. - for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) { - EnumerateValue(I); - EnumerateAttributes(cast(I)->getAttributes()); + for (const Function & F : M) { + EnumerateValue(&F); + EnumerateAttributes(F.getAttributes()); } // Enumerate the aliases. - for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); - I != E; ++I) - EnumerateValue(I); + for (const GlobalAlias &GA : M.aliases()) + EnumerateValue(&GA); // Remember what is the cutoff between globalvalue's and other constants. unsigned FirstConstant = Values.size(); // Enumerate the global variable initializers. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) - if (I->hasInitializer()) - EnumerateValue(I->getInitializer()); + for (const GlobalVariable &GV : M.globals()) + if (GV.hasInitializer()) + EnumerateValue(GV.getInitializer()); // Enumerate the aliasees. - for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); - I != E; ++I) - EnumerateValue(I->getAliasee()); + for (const GlobalAlias &GA : M.aliases()) + EnumerateValue(GA.getAliasee()); // Enumerate the prefix data constants. - for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->hasPrefixData()) - EnumerateValue(I->getPrefixData()); + for (const Function &F : M) + if (F.hasPrefixData()) + EnumerateValue(F.getPrefixData()); // Enumerate the prologue data constants. - for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->hasPrologueData()) - EnumerateValue(I->getPrologueData()); + for (const Function &F : M) + if (F.hasPrologueData()) + EnumerateValue(F.getPrologueData()); // Enumerate the metadata type. //