summaryrefslogtreecommitdiffstats
path: root/src/dyndep.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dyndep.cc')
-rw-r--r--src/dyndep.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dyndep.cc b/src/dyndep.cc
index b388e9b..dd4ed09 100644
--- a/src/dyndep.cc
+++ b/src/dyndep.cc
@@ -97,9 +97,15 @@ bool DyndepLoader::UpdateEdge(Edge* edge, Dyndeps const* dyndeps,
for (std::vector<Node*>::const_iterator i =
dyndeps->implicit_outputs_.begin();
i != dyndeps->implicit_outputs_.end(); ++i) {
- if ((*i)->in_edge() != NULL) {
- *err = "multiple rules generate " + (*i)->path();
- return false;
+ if (Edge* old_in_edge = (*i)->in_edge()) {
+ // This node already has an edge producing it. Fail with an error
+ // unless the edge was generated by ImplicitDepLoader, in which
+ // case we can replace it with the now-known real producer.
+ if (!old_in_edge->generated_by_dep_loader_) {
+ *err = "multiple rules generate " + (*i)->path();
+ return false;
+ }
+ old_in_edge->outputs_.clear();
}
(*i)->set_in_edge(edge);
}