diff options
author | Evan Martin <martine@danga.com> | 2011-12-07 16:55:46 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-12-07 16:55:46 (GMT) |
commit | 5394fefc2bc297e3c7bc13d8c54823f34d82877c (patch) | |
tree | 3fe298bd44b2d4562d1245b1d8007dbe69cb751c /src/state.h | |
parent | c6144ccfe366b694bf034bdafa07e7c47ac8bf30 (diff) | |
download | Ninja-5394fefc2bc297e3c7bc13d8c54823f34d82877c.zip Ninja-5394fefc2bc297e3c7bc13d8c54823f34d82877c.tar.gz Ninja-5394fefc2bc297e3c7bc13d8c54823f34d82877c.tar.bz2 |
merge StatCache into State
I think I had originally imagined StatCache would contain more state,
but at this point it's clear it was just managing a single map, which
could just as well be in the already-small State object.
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/state.h b/src/state.h index 1e2cd30..6b8d8b2 100644 --- a/src/state.h +++ b/src/state.h @@ -19,11 +19,10 @@ #include <map> #include <string> #include <vector> +using namespace std; #include "eval_env.h" -#include "stat_cache.h" - -using namespace std; +#include "hash_map.h" struct BuildLog; struct Edge; @@ -45,16 +44,21 @@ struct State { void AddIn(Edge* edge, const string& path); void AddOut(Edge* edge, const string& path); bool AddDefault(const string& path, string* error); + /// Reset state. Keeps all nodes and edges, but restores them to the + /// state where we haven't yet examined the disk for dirty state. void Reset(); + /// Dump the nodes (useful for debugging). + void Dump(); + /// @return the root node(s) of the graph. (Root nodes have no output edges). /// @param error where to write the error message if somethings went wrong. vector<Node*> RootNodes(string* error); vector<Node*> DefaultNodes(string* error); - StatCache* stat_cache() { return &stat_cache_; } - - StatCache stat_cache_; + /// Mapping of path -> Node. + typedef ExternalStringHashMap<Node*>::Type Paths; + Paths paths_; /// All the rules used in the graph. map<string, const Rule*> rules_; |