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
3 // found in the LICENSE file.
5 #include "tools/gn/builder_record.h"
7 #include "tools/gn/item.h"
9 BuilderRecord::BuilderRecord(ItemType type
, const Label
& label
)
12 originally_referenced_from_(nullptr),
13 should_generate_(false),
17 BuilderRecord::~BuilderRecord() {
21 const char* BuilderRecord::GetNameForType(ItemType type
) {
36 bool BuilderRecord::IsItemOfType(const Item
* item
, ItemType type
) {
39 return !!item
->AsTarget();
41 return !!item
->AsConfig();
43 return !!item
->AsToolchain();
51 BuilderRecord::ItemType
BuilderRecord::TypeOfItem(const Item
* item
) {
56 if (item
->AsToolchain())
57 return ITEM_TOOLCHAIN
;
63 void BuilderRecord::AddDep(BuilderRecord
* record
) {
64 all_deps_
.insert(record
);
65 if (!record
->resolved()) {
66 unresolved_deps_
.insert(record
);
67 record
->waiting_on_resolution_
.insert(this);