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

Side by Side Diff: tools/gn/header_checker.cc

Issue 2105553005: tools/gn: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « tools/gn/function_get_target_outputs.cc ('k') | tools/gn/input_conversion_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/header_checker.h" 5 #include "tools/gn/header_checker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return a->label().dir() == b->label().dir() && 122 return a->label().dir() == b->label().dir() &&
123 a->label().name() == b->label().name(); 123 a->label().name() == b->label().name();
124 } 124 }
125 125
126 } // namespace 126 } // namespace
127 127
128 HeaderChecker::HeaderChecker(const BuildSettings* build_settings, 128 HeaderChecker::HeaderChecker(const BuildSettings* build_settings,
129 const std::vector<const Target*>& targets) 129 const std::vector<const Target*>& targets)
130 : main_loop_(base::MessageLoop::current()), 130 : main_loop_(base::MessageLoop::current()),
131 build_settings_(build_settings) { 131 build_settings_(build_settings) {
132 for (const auto& target : targets) 132 for (auto* target : targets)
133 AddTargetToFileMap(target, &file_map_); 133 AddTargetToFileMap(target, &file_map_);
134 } 134 }
135 135
136 HeaderChecker::~HeaderChecker() { 136 HeaderChecker::~HeaderChecker() {
137 } 137 }
138 138
139 bool HeaderChecker::Run(const std::vector<const Target*>& to_check, 139 bool HeaderChecker::Run(const std::vector<const Target*>& to_check,
140 bool force_check, 140 bool force_check,
141 std::vector<Err>* errors) { 141 std::vector<Err>* errors) {
142 FileMap files_to_check; 142 FileMap files_to_check;
143 for (const auto& check : to_check) 143 for (auto* check : to_check)
144 AddTargetToFileMap(check, &files_to_check); 144 AddTargetToFileMap(check, &files_to_check);
145 RunCheckOverFiles(files_to_check, force_check); 145 RunCheckOverFiles(files_to_check, force_check);
146 146
147 if (errors_.empty()) 147 if (errors_.empty())
148 return true; 148 return true;
149 *errors = errors_; 149 *errors = errors_;
150 return false; 150 return false;
151 } 151 }
152 152
153 void HeaderChecker::RunCheckOverFiles(const FileMap& files, bool force_check) { 153 void HeaderChecker::RunCheckOverFiles(const FileMap& files, bool force_check) {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 560 }
561 } 561 }
562 } 562 }
563 563
564 // Only display toolchains on labels if they don't all match. 564 // Only display toolchains on labels if they don't all match.
565 bool include_toolchain = !targets_with_other_toolchains.empty(); 565 bool include_toolchain = !targets_with_other_toolchains.empty();
566 566
567 std::string msg = "It is not in any dependency of\n " + 567 std::string msg = "It is not in any dependency of\n " +
568 from_target->label().GetUserVisibleName(include_toolchain); 568 from_target->label().GetUserVisibleName(include_toolchain);
569 msg += "\nThe include file is in the target(s):\n"; 569 msg += "\nThe include file is in the target(s):\n";
570 for (const auto& target : targets_with_matching_toolchains) 570 for (auto* target : targets_with_matching_toolchains)
571 msg += " " + target->label().GetUserVisibleName(include_toolchain) + "\n"; 571 msg += " " + target->label().GetUserVisibleName(include_toolchain) + "\n";
572 for (const auto& target : targets_with_other_toolchains) 572 for (auto* target : targets_with_other_toolchains)
573 msg += " " + target->label().GetUserVisibleName(include_toolchain) + "\n"; 573 msg += " " + target->label().GetUserVisibleName(include_toolchain) + "\n";
574 if (targets_with_other_toolchains.size() + 574 if (targets_with_other_toolchains.size() +
575 targets_with_matching_toolchains.size() > 1) 575 targets_with_matching_toolchains.size() > 1)
576 msg += "at least one of "; 576 msg += "at least one of ";
577 msg += "which should somehow be reachable."; 577 msg += "which should somehow be reachable.";
578 578
579 // Danger: must call CreatePersistentRange to put in Err. 579 // Danger: must call CreatePersistentRange to put in Err.
580 return Err(CreatePersistentRange(source_file, range), 580 return Err(CreatePersistentRange(source_file, range),
581 "Include not allowed.", msg); 581 "Include not allowed.", msg);
582 } 582 }
583 583
OLDNEW
« no previous file with comments | « tools/gn/function_get_target_outputs.cc ('k') | tools/gn/input_conversion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698