|
Ninja
|
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc. More...
#include <graph.h>
Public Member Functions | |
| void | AddOutEdge (Edge *edge) |
| void | AddValidationOutEdge (Edge *edge) |
| bool | dirty () const |
| void | Dump (const char *prefix="") const |
| bool | dyndep_pending () const |
| bool | exists () const |
| bool | generated_by_dep_loader () const |
| Indicates whether this node was generated from a depfile or dyndep file, instead of being a regular input or output from the Ninja manifest. More... | |
| int | id () const |
| Edge * | in_edge () const |
| void | MarkDirty () |
| void | MarkMissing () |
| Mark the Node as already-stat()ed and missing. More... | |
| TimeStamp | mtime () const |
| Node (const std::string &path, uint64_t slash_bits) | |
| const std::vector< Edge * > & | out_edges () const |
| const std::string & | path () const |
| std::string | PathDecanonicalized () const |
| Get |path()| but use slash_bits to convert back to original slash styles. More... | |
| void | ResetState () |
| Mark as not-yet-stat()ed and not dirty. More... | |
| void | set_dirty (bool dirty) |
| void | set_dyndep_pending (bool pending) |
| void | set_generated_by_dep_loader (bool value) |
| void | set_id (int id) |
| void | set_in_edge (Edge *edge) |
| uint64_t | slash_bits () const |
| bool | Stat (DiskInterface *disk_interface, std::string *err) |
| Return false on error. More... | |
| bool | StatIfNecessary (DiskInterface *disk_interface, std::string *err) |
| Return false on error. More... | |
| bool | status_known () const |
| void | UpdatePhonyMtime (TimeStamp mtime) |
| If the file doesn't exist, set the mtime_ from its dependencies. More... | |
| const std::vector< Edge * > & | validation_out_edges () const |
Static Public Member Functions | |
| static std::string | PathDecanonicalized (const std::string &path, uint64_t slash_bits) |
Private Types | |
| enum | ExistenceStatus { ExistenceStatusUnknown , ExistenceStatusMissing , ExistenceStatusExists } |
Private Attributes | |
| bool | dirty_ = false |
| Dirty is true when the underlying file is out-of-date. More... | |
| bool | dyndep_pending_ = false |
| Store whether dyndep information is expected from this node but has not yet been loaded. More... | |
| ExistenceStatus | exists_ = ExistenceStatusUnknown |
| bool | generated_by_dep_loader_ = true |
| Set to true when this node comes from a depfile, a dyndep file or the deps log. More... | |
| int | id_ = -1 |
| A dense integer id for the node, assigned and used by DepsLog. More... | |
| Edge * | in_edge_ = nullptr |
| The Edge that produces this Node, or NULL when there is no known edge to produce it. More... | |
| TimeStamp | mtime_ = -1 |
| Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: actual file's mtime, or the latest mtime of its dependencies if it doesn't exist. More... | |
| std::vector< Edge * > | out_edges_ |
| All Edges that use this Node as an input. More... | |
| std::string | path_ |
| uint64_t | slash_bits_ = 0 |
| Set bits starting from lowest for backslashes that were normalized to forward slashes by CanonicalizePath. More... | |
| std::vector< Edge * > | validation_out_edges_ |
| All Edges that use this Node as a validation. More... | |
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
|
private |
|
inline |
|
inline |
Definition at line 116 of file graph.h.
References out_edges_.
Referenced by State::AddIn(), ImplicitDepLoader::LoadDepsFromLog(), ImplicitDepLoader::ProcessDepfileDeps(), and DyndepLoader::UpdateEdge().
|
inline |
Definition at line 117 of file graph.h.
References validation_out_edges_.
Referenced by State::AddValidation().
|
inline |
Definition at line 93 of file graph.h.
References dirty_.
Referenced by Plan::AddSubTarget(), Plan::CleanNode(), State::Dump(), Plan::RefreshDyndepDependents(), set_dirty(), TEST_F(), and TestPhonyUseCase().
| void Node::Dump | ( | const char * | prefix = "" | ) | const |
|
inline |
Definition at line 97 of file graph.h.
References dyndep_pending_.
Referenced by GraphViz::AddTarget(), Cleaner::LoadDyndeps(), Plan::NodeFinished(), DependencyScan::RecomputeNodeDirty(), and TEST_F().
|
inline |
Definition at line 74 of file graph.h.
References ExistenceStatusExists, and exists_.
Referenced by DependencyScan::RecomputeNodeDirty(), DependencyScan::RecomputeOutputDirty(), and TestPhonyUseCase().
|
inline |
Indicates whether this node was generated from a depfile or dyndep file, instead of being a regular input or output from the Ninja manifest.
Definition at line 105 of file graph.h.
References generated_by_dep_loader_.
Referenced by Plan::AddSubTarget(), and ManifestParser::ParseEdge().
|
inline |
Definition at line 111 of file graph.h.
References id_.
Referenced by State::Dump(), DepsLog::GetDeps(), DepsLog::Load(), DepsLog::RecordDeps(), and set_id().
|
inline |
Definition at line 100 of file graph.h.
References in_edge_.
Referenced by State::AddOut(), Plan::AddSubTarget(), GraphViz::AddTarget(), Cleaner::CleanDead(), CommandCollector::CollectFrom(), Plan::ComputeCriticalPath(), MissingDependencyScannerTest::CreateGraphDependencyBetween(), BuildTest::Dirty(), Cleaner::DoCleanTarget(), DepsLog::IsDepsEntryLiveFor(), DyndepParser::ParseEdge(), MissingDependencyScanner::ProcessNode(), MissingDependencyScanner::ProcessNodeDeps(), DependencyScan::RecomputeNodeDirty(), Plan::RefreshDyndepDependents(), TEST_F(), DyndepLoader::UpdateEdge(), DependencyScan::VerifyDAG(), VerifyGraph(), and InputsCollector::VisitNode().
|
inline |
Definition at line 95 of file graph.h.
References dirty_.
Referenced by BuildTest::Dirty(), DependencyScan::RecomputeNodeDirty(), and TEST_F().
|
inline |
Mark the Node as already-stat()ed and missing.
Definition at line 67 of file graph.h.
References ExistenceStatusMissing, exists_, and mtime_.
Referenced by BuildTest::Dirty().
|
inline |
Definition at line 91 of file graph.h.
References mtime_.
Referenced by Plan::CleanNode(), ImplicitDepLoader::LoadDepsFromLog(), DependencyScan::RecomputeNodeDirty(), DependencyScan::RecomputeOutputDirty(), TEST_F(), and TestPhonyUseCase().
|
inline |
Definition at line 114 of file graph.h.
References out_edges_.
Referenced by Cleaner::CleanDead(), Plan::CleanNode(), Plan::DyndepsLoaded(), DyndepLoader::LoadDyndeps(), Plan::NodeFinished(), TEST_F(), Plan::UnmarkDependents(), and VerifyGraph().
|
inline |
Definition at line 82 of file graph.h.
References path_.
Referenced by Plan::AddSubTarget(), GraphViz::AddTarget(), Cleaner::DoCleanTarget(), State::Dump(), State::GetNode(), ImplicitDepLoader::LoadDepFile(), ImplicitDepLoader::LoadDepsFromLog(), DyndepLoader::LoadDyndepFile(), DyndepLoader::LoadDyndeps(), MissingDependencyPrinter::OnMissingDep(), matches::operator()(), ManifestParser::ParseEdge(), MissingDependencyScanner::ProcessNodeDeps(), DependencyScan::RecomputeNodeDirty(), DependencyScan::RecomputeOutputDirty(), DepsLog::RecordId(), TEST_F(), and DyndepLoader::UpdateEdge().
|
inline |
Get |path()| but use slash_bits to convert back to original slash styles.
Definition at line 84 of file graph.h.
References path_, and slash_bits_.
|
static |
|
inline |
|
inline |
Definition at line 94 of file graph.h.
References dirty(), and dirty_.
Referenced by Plan::CleanNode(), and DependencyScan::RecomputeNodeDirty().
|
inline |
Definition at line 98 of file graph.h.
References dyndep_pending_.
Referenced by DyndepLoader::LoadDyndeps(), and ManifestParser::ParseEdge().
|
inline |
Definition at line 107 of file graph.h.
References generated_by_dep_loader_.
Referenced by State::AddIn(), State::AddOut(), and State::AddValidation().
|
inline |
Definition at line 112 of file graph.h.
Referenced by DepsLog::Load(), and DepsLog::RecordId().
|
inline |
Definition at line 101 of file graph.h.
References in_edge_.
Referenced by State::AddOut(), and DyndepLoader::UpdateEdge().
|
inline |
Definition at line 89 of file graph.h.
References slash_bits_.
| bool Node::Stat | ( | DiskInterface * | disk_interface, |
| std::string * | err | ||
| ) |
Return false on error.
Definition at line 34 of file graph.cc.
References DiskInterface::Stat().
Referenced by StatIfNecessary(), TEST_F(), and TestPhonyUseCase().
|
inline |
Return false on error.
Definition at line 53 of file graph.h.
References Stat(), and status_known().
Referenced by DependencyScan::RecomputeNodeDirty().
|
inline |
Definition at line 78 of file graph.h.
References ExistenceStatusUnknown, and exists_.
Referenced by State::Dump(), DependencyScan::RecomputeNodeDirty(), and StatIfNecessary().
| void Node::UpdatePhonyMtime | ( | TimeStamp | mtime | ) |
If the file doesn't exist, set the mtime_ from its dependencies.
Definition at line 43 of file graph.cc.
Referenced by DependencyScan::RecomputeOutputDirty().
|
inline |
Definition at line 115 of file graph.h.
References validation_out_edges_.
|
private |
Dirty is true when the underlying file is out-of-date.
But note that Edge::outputs_ready_ is also used in judging which edges to build.
Definition at line 147 of file graph.h.
Referenced by dirty(), MarkDirty(), ResetState(), and set_dirty().
|
private |
Store whether dyndep information is expected from this node but has not yet been loaded.
Definition at line 151 of file graph.h.
Referenced by dyndep_pending(), and set_dyndep_pending().
|
private |
Definition at line 142 of file graph.h.
Referenced by exists(), MarkMissing(), ResetState(), and status_known().
|
private |
Set to true when this node comes from a depfile, a dyndep file or the deps log.
If it does not have a producing edge, the build should not abort if it is missing (as for regular source inputs). By default all nodes have this flag set to true, since the deps and build logs can be loaded before the manifest.
Definition at line 158 of file graph.h.
Referenced by generated_by_dep_loader(), and set_generated_by_dep_loader().
|
private |
|
private |
|
private |
Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: actual file's mtime, or the latest mtime of its dependencies if it doesn't exist.
Definition at line 132 of file graph.h.
Referenced by MarkMissing(), mtime(), and ResetState().
|
private |
All Edges that use this Node as an input.
Definition at line 165 of file graph.h.
Referenced by AddOutEdge(), and out_edges().
|
private |
Definition at line 122 of file graph.h.
Referenced by path(), and PathDecanonicalized().
|
private |
Set bits starting from lowest for backslashes that were normalized to forward slashes by CanonicalizePath.
See |PathDecanonicalized|.
Definition at line 126 of file graph.h.
Referenced by PathDecanonicalized(), and slash_bits().
|
private |
All Edges that use this Node as a validation.
Definition at line 168 of file graph.h.
Referenced by AddValidationOutEdge(), and validation_out_edges().