From c7d6951c92a3153e6e5cec17b70d94d76ff6609f Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Fri, 30 Jan 2009 02:12:57 +0000 Subject: Add some comments. llvm-svn: 63364 --- llvm/tools/llvmc/driver/CompilationGraph.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'llvm/tools') diff --git a/llvm/tools/llvmc/driver/CompilationGraph.cpp b/llvm/tools/llvmc/driver/CompilationGraph.cpp index 2c59ee6314c..238ef6f42a7 100644 --- a/llvm/tools/llvmc/driver/CompilationGraph.cpp +++ b/llvm/tools/llvmc/driver/CompilationGraph.cpp @@ -390,6 +390,8 @@ int CompilationGraph::CheckMultipleDefaultEdges() const { int ret = 0; InputLanguagesSet Dummy; + // For all nodes, just iterate over the outgoing edges and check if there is + // more than one edge with maximum weight. for (const_nodes_iterator B = this->NodesMap.begin(), E = this->NodesMap.end(); B != E; ++B) { const Node& N = B->second; @@ -423,6 +425,9 @@ int CompilationGraph::CheckCycles() { std::queue Q; Q.push(&getNode("root")); + // Try to delete all nodes that have no ingoing edges, starting from the + // root. If there are any nodes left after this operation, then we have a + // cycle. This relies on '--check-graph' not performing the topological sort. while (!Q.empty()) { Node* A = Q.front(); Q.pop(); @@ -447,7 +452,6 @@ int CompilationGraph::CheckCycles() { return 0; } - int CompilationGraph::Check () { // We try to catch as many errors as we can in one go. int ret = 0; -- cgit v1.2.3