summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/rulegraph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/buildgraph/rulegraph.cpp')
-rw-r--r--src/lib/buildgraph/rulegraph.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/buildgraph/rulegraph.cpp b/src/lib/buildgraph/rulegraph.cpp
index b33c8891d..9a598032b 100644
--- a/src/lib/buildgraph/rulegraph.cpp
+++ b/src/lib/buildgraph/rulegraph.cpp
@@ -100,6 +100,13 @@ QList<RuleConstPtr> RuleGraph::topSorted()
return result;
}
+void RuleGraph::accept(RuleGraphVisitor *visitor) const
+{
+ const RuleConstPtr nullParent;
+ foreach (int rootIndex, m_rootRules)
+ traverse(visitor, nullParent, m_artifacts.at(rootIndex));
+}
+
void RuleGraph::dump() const
{
QByteArray indent;
@@ -210,5 +217,13 @@ QList<RuleConstPtr> RuleGraph::topSort(const RuleConstPtr &rule, QSet<const Rule
return result;
}
+void RuleGraph::traverse(RuleGraphVisitor *visitor, const RuleConstPtr &parentRule,
+ const RuleConstPtr &rule) const
+{
+ visitor->visit(parentRule, rule);
+ foreach (int childIndex, m_children.at(rule->ruleGraphId))
+ traverse(visitor, rule, m_artifacts.at(childIndex));
+}
+
} // namespace Internal
} // namespace qbs