Use for range loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-05-08 18:40:06 +00:00
parent dd2dc5b166
commit 5fd4b41a36

View File

@ -1690,9 +1690,8 @@ void CppWriter::printFunctionUses(const Function* F) {
// Print the function declarations for any functions encountered // Print the function declarations for any functions encountered
nl(Out) << "// Function Declarations"; nl(Out); nl(Out) << "// Function Declarations"; nl(Out);
for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end(); for (auto *GV : gvs) {
I != E; ++I) { if (Function *Fun = dyn_cast<Function>(GV)) {
if (Function* Fun = dyn_cast<Function>(*I)) {
if (!is_inline || Fun != F) if (!is_inline || Fun != F)
printFunctionHead(Fun); printFunctionHead(Fun);
} }
@ -1700,17 +1699,15 @@ void CppWriter::printFunctionUses(const Function* F) {
// Print the global variable declarations for any variables encountered // Print the global variable declarations for any variables encountered
nl(Out) << "// Global Variable Declarations"; nl(Out); nl(Out) << "// Global Variable Declarations"; nl(Out);
for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end(); for (auto *GV : gvs) {
I != E; ++I) { if (GlobalVariable *F = dyn_cast<GlobalVariable>(GV))
if (GlobalVariable* F = dyn_cast<GlobalVariable>(*I))
printVariableHead(F); printVariableHead(F);
} }
// Print the constants found // Print the constants found
nl(Out) << "// Constant Definitions"; nl(Out); nl(Out) << "// Constant Definitions"; nl(Out);
for (SmallPtrSet<Constant*,64>::iterator I = consts.begin(), for (const auto *C : consts) {
E = consts.end(); I != E; ++I) { printConstant(C);
printConstant(*I);
} }
// Process the global variables definitions now that all the constants have // Process the global variables definitions now that all the constants have
@ -1718,10 +1715,9 @@ void CppWriter::printFunctionUses(const Function* F) {
// initializers. // initializers.
if (GenerationType != GenFunction) { if (GenerationType != GenFunction) {
nl(Out) << "// Global Variable Definitions"; nl(Out); nl(Out) << "// Global Variable Definitions"; nl(Out);
for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end(); for (const auto &GV : gvs) {
I != E; ++I) { if (GlobalVariable *Var = dyn_cast<GlobalVariable>(GV))
if (GlobalVariable* GV = dyn_cast<GlobalVariable>(*I)) printVariableBody(Var);
printVariableBody(GV);
} }
} }
} }