[llvm] r224005 - Use range-based for loops. NFC
Craig Topper
craig.topper at gmail.com
Wed Dec 10 23:04:55 PST 2014
Author: ctopper
Date: Thu Dec 11 01:04:54 2014
New Revision: 224005
URL: http://llvm.org/viewvc/llvm-project?rev=224005&view=rev
Log:
Use range-based for loops. NFC
Modified:
llvm/trunk/lib/TableGen/Main.cpp
llvm/trunk/utils/TableGen/TableGen.cpp
Modified: llvm/trunk/lib/TableGen/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Main.cpp?rev=224005&r1=224004&r2=224005&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Main.cpp (original)
+++ llvm/trunk/lib/TableGen/Main.cpp Thu Dec 11 01:04:54 2014
@@ -64,11 +64,8 @@ static int createDependencyFile(const TG
return 1;
}
DepOut.os() << OutputFilename << ":";
- const TGLexer::DependenciesMapTy &Dependencies = Parser.getDependencies();
- for (TGLexer::DependenciesMapTy::const_iterator I = Dependencies.begin(),
- E = Dependencies.end();
- I != E; ++I) {
- DepOut.os() << " " << I->first;
+ for (const auto &Dep : Parser.getDependencies()) {
+ DepOut.os() << ' ' << Dep.first;
}
DepOut.os() << "\n";
DepOut.keep();
Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=224005&r1=224004&r2=224005&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Thu Dec 11 01:04:54 2014
@@ -143,9 +143,8 @@ bool LLVMTableGenMain(raw_ostream &OS, R
break;
case PrintEnums:
{
- std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
- for (unsigned i = 0, e = Recs.size(); i != e; ++i)
- OS << Recs[i]->getName() << ", ";
+ for (Record *Rec : Records.getAllDerivedDefinitions(Class))
+ OS << Rec->getName() << ", ";
OS << "\n";
break;
}
@@ -153,13 +152,12 @@ bool LLVMTableGenMain(raw_ostream &OS, R
{
SetTheory Sets;
Sets.addFieldExpander("Set", "Elements");
- std::vector<Record*> Recs = Records.getAllDerivedDefinitions("Set");
- for (unsigned i = 0, e = Recs.size(); i != e; ++i) {
- OS << Recs[i]->getName() << " = [";
- const std::vector<Record*> *Elts = Sets.expand(Recs[i]);
+ for (Record *Rec : Records.getAllDerivedDefinitions("Set")) {
+ OS << Rec->getName() << " = [";
+ const std::vector<Record*> *Elts = Sets.expand(Rec);
assert(Elts && "Couldn't expand Set instance");
- for (unsigned ei = 0, ee = Elts->size(); ei != ee; ++ei)
- OS << ' ' << (*Elts)[ei]->getName();
+ for (Record *Elt : *Elts)
+ OS << ' ' << Elt->getName();
OS << " ]\n";
}
break;
More information about the llvm-commits
mailing list