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

Unified Diff: tools/gn/header_checker.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/header_checker.cc
diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc
index 423929b0080aec5ef820ead271cc2f8779b9b8cf..4d2f4cbcb262f7aa7ef8eaa51e2cb3a90655225d 100644
--- a/tools/gn/header_checker.cc
+++ b/tools/gn/header_checker.cc
@@ -330,10 +330,10 @@ bool HeaderChecker::CheckInclude(const Target* from_target,
Err last_error;
bool found_dependency = false;
- for (size_t i = 0; i < targets.size(); i++) {
+ for (const auto& target : targets) {
// We always allow source files in a target to include headers also in that
// target.
- const Target* to_target = targets[i].target;
+ const Target* to_target = target.target;
if (to_target == from_target)
return true;
@@ -357,20 +357,19 @@ bool HeaderChecker::CheckInclude(const Target* from_target,
found_dependency = true;
- if (targets[i].is_public && is_permitted_chain) {
+ if (target.is_public && is_permitted_chain) {
// This one is OK, we're done.
last_error = Err();
break;
}
// Diagnose the error.
- if (!targets[i].is_public) {
+ if (!target.is_public) {
// Danger: must call CreatePersistentRange to put in Err.
- last_error = Err(
- CreatePersistentRange(source_file, range),
- "Including a private header.",
- "This file is private to the target " +
- targets[i].target->label().GetUserVisibleName(false));
+ last_error = Err(CreatePersistentRange(source_file, range),
+ "Including a private header.",
+ "This file is private to the target " +
+ target.target->label().GetUserVisibleName(false));
} else if (!is_permitted_chain) {
last_error = Err(
CreatePersistentRange(source_file, range),

Powered by Google App Engine
This is Rietveld 408576698