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 #ifndef TOOLS_GN_ITEM_H_
6 #define TOOLS_GN_ITEM_H_
10 #include "tools/gn/label.h"
18 // A named item (target, config, etc.) that participates in the dependency
22 Item(const Settings
* settings
, const Label
& label
);
25 const Settings
* settings() const { return settings_
; }
27 // This is guaranteed to never change after construction so this can be
28 // accessed from any thread with no locking once the item is constructed.
29 const Label
& label() const { return label_
; }
31 const ParseNode
* defined_from() const { return defined_from_
; }
32 void set_defined_from(const ParseNode
* df
) { defined_from_
= df
; }
35 virtual Config
* AsConfig();
36 virtual const Config
* AsConfig() const;
37 virtual Target
* AsTarget();
38 virtual const Target
* AsTarget() const;
39 virtual Toolchain
* AsToolchain();
40 virtual const Toolchain
* AsToolchain() const;
42 // Returns a name like "target" or "config" for the type of item this is, to
43 // be used in logging and error messages.
44 std::string
GetItemTypeName() const;
46 // Called when this item is resolved, meaning it and all of its dependents
47 // have no unresolved deps.
48 virtual void OnResolved() {}
51 const Settings
* settings_
;
53 const ParseNode
* defined_from_
;
56 #endif // TOOLS_GN_ITEM_H_