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

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

Issue 1375023003: tools/gn: Remove code for forward_dependent_configs_from variable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | tools/gn/command_desc.cc » ('j') | tools/gn/target_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/builder.h" 5 #include "tools/gn/builder.h"
6 6
7 #include "tools/gn/config.h" 7 #include "tools/gn/config.h"
8 #include "tools/gn/deps_iterator.h" 8 #include "tools/gn/deps_iterator.h"
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/loader.h" 10 #include "tools/gn/loader.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 return false; 474 return false;
475 const_cast<LabelConfigPair&>(cur).ptr = record->item()->AsConfig(); 475 const_cast<LabelConfigPair&>(cur).ptr = record->item()->AsConfig();
476 } 476 }
477 return true; 477 return true;
478 } 478 }
479 479
480 // "Forward dependent configs" should refer to targets in the deps that should 480 // "Forward dependent configs" should refer to targets in the deps that should
481 // have their configs forwarded. 481 // have their configs forwarded.
482 bool Builder::ResolveForwardDependentConfigs(Target* target, Err* err) { 482 bool Builder::ResolveForwardDependentConfigs(Target* target, Err* err) {
483 const UniqueVector<LabelTargetPair>& configs = 483 const UniqueVector<LabelTargetPair>& configs =
484 target->forward_dependent_configs(); 484 target->forward_dependent_configs();
brettw 2015/10/05 18:06:06 Is this patch trying to remove all the code for fo
tfarina 2015/10/06 03:28:50 Done.
485 485
486 // Assume that the lists are small so that brute-force n^2 is appropriate. 486 // Assume that the lists are small so that brute-force n^2 is appropriate.
487 for (const auto& config : configs) { 487 for (const auto& config : configs) {
488 for (const auto& dep_pair : target->GetDeps(Target::DEPS_LINKED)) { 488 for (const auto& dep_pair : target->GetDeps(Target::DEPS_LINKED)) {
489 if (config.label == dep_pair.label) { 489 if (config.label == dep_pair.label) {
490 DCHECK(dep_pair.ptr); // Should already be resolved. 490 DCHECK(dep_pair.ptr); // Should already be resolved.
491 // UniqueVector's contents are constant so uniqueness is preserved, but 491 // UniqueVector's contents are constant so uniqueness is preserved, but
492 // we want to update this pointer which doesn't change uniqueness 492 // we want to update this pointer which doesn't change uniqueness
493 // (uniqueness in this vector is determined by the label only). 493 // (uniqueness in this vector is determined by the label only).
494 const_cast<LabelTargetPair&>(config).ptr = dep_pair.ptr; 494 const_cast<LabelTargetPair&>(config).ptr = dep_pair.ptr;
495 break; 495 break;
496 } 496 }
497 } 497 }
498 if (!config.ptr) {
499 *err = Err(target->defined_from(),
500 "Target in forward_dependent_configs_from was not listed in the deps",
501 "This target has a forward_dependent_configs_from entry that was "
502 "not present in\nthe deps. A target can only forward things it "
503 "depends on. It was forwarding:\n " +
504 config.label.GetUserVisibleName(false));
505 return false;
506 }
507 } 498 }
508 return true; 499 return true;
509 } 500 }
510 501
511 bool Builder::ResolveToolchain(Target* target, Err* err) { 502 bool Builder::ResolveToolchain(Target* target, Err* err) {
512 BuilderRecord* record = GetResolvedRecordOfType( 503 BuilderRecord* record = GetResolvedRecordOfType(
513 target->settings()->toolchain_label(), target->defined_from(), 504 target->settings()->toolchain_label(), target->defined_from(),
514 BuilderRecord::ITEM_TOOLCHAIN, err); 505 BuilderRecord::ITEM_TOOLCHAIN, err);
515 if (!record) { 506 if (!record) {
516 *err = Err(target->defined_from(), 507 *err = Err(target->defined_from(),
(...skipping 18 matching lines...) Expand all
535 std::string ret; 526 std::string ret;
536 for (size_t i = 0; i < cycle.size(); i++) { 527 for (size_t i = 0; i < cycle.size(); i++) {
537 ret += " " + cycle[i]->label().GetUserVisibleName(false); 528 ret += " " + cycle[i]->label().GetUserVisibleName(false);
538 if (i != cycle.size() - 1) 529 if (i != cycle.size() - 1)
539 ret += " ->"; 530 ret += " ->";
540 ret += "\n"; 531 ret += "\n";
541 } 532 }
542 533
543 return ret; 534 return ret;
544 } 535 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/command_desc.cc » ('j') | tools/gn/target_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698