summaryrefslogtreecommitdiffstats
path: root/src/state.h
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2023-11-06 13:53:29 (GMT)
committerDavid 'Digit' Turner <digit+github@google.com>2023-11-07 19:10:35 (GMT)
commita744eea2b6c9b37024b12e749e61170e5c87d171 (patch)
tree24b3aee9fc9d25ac92539459242a82d895fd7c15 /src/state.h
parent2a2e4703f4c13d89dd97c32497b8af1dad3262f7 (diff)
downloadNinja-a744eea2b6c9b37024b12e749e61170e5c87d171.zip
Ninja-a744eea2b6c9b37024b12e749e61170e5c87d171.tar.gz
Ninja-a744eea2b6c9b37024b12e749e61170e5c87d171.tar.bz2
Remove phony edges for nodes created by a dependency loader.
This patch simplifies Ninja internals without modifying its behavior. It removes the creation (and removal) of phony edges as producers for nodes loaded by dependency loaders, i.e. coming from depfiles, dyndep files or the deps log. These edges were only used to ensure the build did not abort when these files are missing, unlike regular source inputs. This can be easily checked by adding a new flag to the Node class instead. This makes it easier to reason about how Ninja works internally. More specifically: - Move the generated_by_dep_loader_ flag from the Edge class to the Node class. The flag is true by default to minimize changes to the source code, since node instances can be first created by reading the deps or build logs before the manifest itself. - Modify Plan::AddSubTarget() to avoid aborting the build when a generated-by-deploader node is missing. Instead the function exits immediately, which corresponds to what happened before. - State::AddOut(), State::AddIn(), State::AddValidation(): Ensure that nodes added by these methods, which are only called from the manifest parser and unit-tests set the |generated_by_dep_loader_| flag to false, to indicate that these are regular input / output nodes. - ManifestParser::ParseEdge(): Add an assertion verifying that the dyndep file is marked as a regular input. - DyndepLoader::UpdateEdge(): Remove code path that looked for phony in-edges and ignored them. - DepLoader::CreatePhonyInEdge() is removed as no longer necessary. + Update a few places in unit-tests that were checking for the creation of the phony edges. Fuchsia-Topic: persistent-mode Change-Id: I98998238002351ef9c7a103040eb8a26d4183969
Diffstat (limited to 'src/state.h')
-rw-r--r--src/state.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/state.h b/src/state.h
index 878ac6d..886b78f 100644
--- a/src/state.h
+++ b/src/state.h
@@ -105,6 +105,9 @@ struct State {
Node* LookupNode(StringPiece path) const;
Node* SpellcheckNode(const std::string& path);
+ /// Add input / output / validation nodes to a given edge. This also
+ /// ensures that the generated_by_dep_loader() flag for all these nodes
+ /// is set to false, to indicate that they come from the input manifest.
void AddIn(Edge* edge, StringPiece path, uint64_t slash_bits);
bool AddOut(Edge* edge, StringPiece path, uint64_t slash_bits);
void AddValidation(Edge* edge, StringPiece path, uint64_t slash_bits);