OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/commands.h" | 5 #include "tools/gn/commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "tools/gn/builder.h" | 9 #include "tools/gn/builder.h" |
10 #include "tools/gn/filesystem_utils.h" | 10 #include "tools/gn/filesystem_utils.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (indent) | 291 if (indent) |
292 OutputString(" "); | 292 OutputString(" "); |
293 OutputString(file + "\n"); | 293 OutputString(file + "\n"); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 void PrintTargetsAsLabels(bool indent, | 297 void PrintTargetsAsLabels(bool indent, |
298 const std::vector<const Target*>& targets) { | 298 const std::vector<const Target*>& targets) { |
299 // Putting the labels into a set automatically sorts them for us. | 299 // Putting the labels into a set automatically sorts them for us. |
300 std::set<Label> unique_labels; | 300 std::set<Label> unique_labels; |
301 for (const auto& target : targets) | 301 for (auto* target : targets) |
302 unique_labels.insert(target->label()); | 302 unique_labels.insert(target->label()); |
303 | 303 |
304 // Grab the label of the default toolchain from the first target. | 304 // Grab the label of the default toolchain from the first target. |
305 Label default_tc_label = | 305 Label default_tc_label = |
306 targets[0]->settings()->default_toolchain_label(); | 306 targets[0]->settings()->default_toolchain_label(); |
307 | 307 |
308 for (const Label& label : unique_labels) { | 308 for (const Label& label : unique_labels) { |
309 // Print toolchain only for ones not in the default toolchain. | 309 // Print toolchain only for ones not in the default toolchain. |
310 if (indent) | 310 if (indent) |
311 OutputString(" "); | 311 OutputString(" "); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 config_matches, toolchain_matches, | 439 config_matches, toolchain_matches, |
440 file_matches)) | 440 file_matches)) |
441 return false; | 441 return false; |
442 } | 442 } |
443 return true; | 443 return true; |
444 } | 444 } |
445 | 445 |
446 void FilterTargetsByPatterns(const std::vector<const Target*>& input, | 446 void FilterTargetsByPatterns(const std::vector<const Target*>& input, |
447 const std::vector<LabelPattern>& filter, | 447 const std::vector<LabelPattern>& filter, |
448 std::vector<const Target*>* output) { | 448 std::vector<const Target*>* output) { |
449 for (const auto& target : input) { | 449 for (auto* target : input) { |
450 for (const auto& pattern : filter) { | 450 for (const auto& pattern : filter) { |
451 if (pattern.Matches(target->label())) { | 451 if (pattern.Matches(target->label())) { |
452 output->push_back(target); | 452 output->push_back(target); |
453 break; | 453 break; |
454 } | 454 } |
455 } | 455 } |
456 } | 456 } |
457 } | 457 } |
458 | 458 |
459 void FilterTargetsByPatterns(const std::vector<const Target*>& input, | 459 void FilterTargetsByPatterns(const std::vector<const Target*>& input, |
460 const std::vector<LabelPattern>& filter, | 460 const std::vector<LabelPattern>& filter, |
461 UniqueVector<const Target*>* output) { | 461 UniqueVector<const Target*>* output) { |
462 for (const auto& target : input) { | 462 for (auto* target : input) { |
463 for (const auto& pattern : filter) { | 463 for (const auto& pattern : filter) { |
464 if (pattern.Matches(target->label())) { | 464 if (pattern.Matches(target->label())) { |
465 output->push_back(target); | 465 output->push_back(target); |
466 break; | 466 break; |
467 } | 467 } |
468 } | 468 } |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 bool FilterPatternsFromString(const BuildSettings* build_settings, | 472 bool FilterPatternsFromString(const BuildSettings* build_settings, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 } | 516 } |
517 | 517 |
518 void FilterAndPrintTargetSet(bool indent, | 518 void FilterAndPrintTargetSet(bool indent, |
519 const std::set<const Target*>& targets) { | 519 const std::set<const Target*>& targets) { |
520 std::vector<const Target*> target_vector(targets.begin(), targets.end()); | 520 std::vector<const Target*> target_vector(targets.begin(), targets.end()); |
521 FilterAndPrintTargets(indent, &target_vector); | 521 FilterAndPrintTargets(indent, &target_vector); |
522 } | 522 } |
523 | 523 |
524 } // namespace commands | 524 } // namespace commands |
OLD | NEW |