Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: tools/gn/substitution_pattern.cc

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/substitution_pattern.cc
diff --git a/tools/gn/substitution_pattern.cc b/tools/gn/substitution_pattern.cc
index 60ec191bcc0681fa7cb953815e84441ce64c8b01..838a5a7a471449471629d7f59695a800d1c06320 100644
--- a/tools/gn/substitution_pattern.cc
+++ b/tools/gn/substitution_pattern.cc
@@ -101,19 +101,19 @@ SubstitutionPattern SubstitutionPattern::MakeForTest(const char* str) {
std::string SubstitutionPattern::AsString() const {
std::string result;
- for (size_t i = 0; i < ranges_.size(); i++) {
- if (ranges_[i].type == SUBSTITUTION_LITERAL)
- result.append(ranges_[i].literal);
+ for (const auto& elem : ranges_) {
+ if (elem.type == SUBSTITUTION_LITERAL)
+ result.append(elem.literal);
else
- result.append(kSubstitutionNames[ranges_[i].type]);
+ result.append(kSubstitutionNames[elem.type]);
}
return result;
}
void SubstitutionPattern::FillRequiredTypes(SubstitutionBits* bits) const {
- for (size_t i = 0; i < ranges_.size(); i++) {
- if (ranges_[i].type != SUBSTITUTION_LITERAL)
- bits->used[static_cast<size_t>(ranges_[i].type)] = true;
+ for (const auto& elem : ranges_) {
+ if (elem.type != SUBSTITUTION_LITERAL)
+ bits->used[static_cast<size_t>(elem.type)] = true;
}
}
« tools/gn/pattern.cc ('K') | « tools/gn/standard_out.cc ('k') | tools/gn/toolchain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698