diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-09-18 02:07:35 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-18 22:01:48 (GMT) |
commit | 5ff5891f5bed923b983c0f5a23c16d988d55f30e (patch) | |
tree | d882ee9f327e7ab138429dcee85625b88d7fa915 /src/graph.h | |
parent | afbe2185a3bbd2453d6b1c27ee8f7c1cce6371a3 (diff) | |
download | Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.zip Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.tar.gz Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.tar.bz2 |
Split Node::dirty_ into two flags: Node::dirty_ and Edge::outputs_ready_
dirty_ is intended to remain static during the build (unless a restat
occurs), while outputs_ready_ reflects the dynamic state of the build.
Diffstat (limited to 'src/graph.h')
-rw-r--r-- | src/graph.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/graph.h b/src/graph.h index 5b6bdf2..079db43 100644 --- a/src/graph.h +++ b/src/graph.h @@ -57,21 +57,6 @@ struct FileStat { Node* node_; }; -struct Edge; - -/// Information about a node in the dependency graph: the file, whether -/// it's dirty, etc. -struct Node { - Node(FileStat* file) : file_(file), dirty_(false), in_edge_(NULL) {} - - bool dirty() const { return dirty_; } - - FileStat* file_; - bool dirty_; - Edge* in_edge_; - vector<Edge*> out_edges_; -}; - /// An invokable build command and associated metadata (description, etc.). struct Rule { Rule(const string& name) : name_(name), generator_(false) { } @@ -86,13 +71,18 @@ struct Rule { bool generator_; }; +struct BuildLog; +struct Node; struct State; /// An edge in the dependency graph; links between Nodes using Rules. struct Edge { - Edge() : rule_(NULL), env_(NULL), implicit_deps_(0), order_only_deps_(0) {} + Edge() : rule_(NULL), env_(NULL), outputs_ready_(false), implicit_deps_(0), + order_only_deps_(0) {} bool RecomputeDirty(State* state, DiskInterface* disk_interface, string* err); + void RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input, + bool dirty, const string& command, Node* output); string EvaluateCommand(); // XXX move to env, take env ptr string GetDescription(); bool LoadDepFile(State* state, DiskInterface* disk_interface, string* err); @@ -103,6 +93,9 @@ struct Edge { vector<Node*> inputs_; vector<Node*> outputs_; Env* env_; + bool outputs_ready_; + + bool outputs_ready() const { return outputs_ready_; } // XXX There are three types of inputs. // 1) explicit deps, which show up as $in on the command line; @@ -128,4 +121,18 @@ struct Edge { bool is_phony() const; }; +/// Information about a node in the dependency graph: the file, whether +/// it's dirty, etc. +struct Node { + Node(FileStat* file) : file_(file), dirty_(false), in_edge_(NULL) {} + + bool dirty() const { return dirty_; } + bool ready() const { return !in_edge_ || in_edge_->outputs_ready(); } + + FileStat* file_; + bool dirty_; + Edge* in_edge_; + vector<Edge*> out_edges_; +}; + #endif // NINJA_GRAPH_H_ |