Skip to content

Commit 7ba6052

Browse files
author
Mikhail Glushenkov
committed
Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63364 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 072e99e commit 7ba6052

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/llvmc/driver/CompilationGraph.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ int CompilationGraph::CheckMultipleDefaultEdges() const {
390390
int ret = 0;
391391
InputLanguagesSet Dummy;
392392

393+
// For all nodes, just iterate over the outgoing edges and check if there is
394+
// more than one edge with maximum weight.
393395
for (const_nodes_iterator B = this->NodesMap.begin(),
394396
E = this->NodesMap.end(); B != E; ++B) {
395397
const Node& N = B->second;
@@ -423,6 +425,9 @@ int CompilationGraph::CheckCycles() {
423425
std::queue<Node*> Q;
424426
Q.push(&getNode("root"));
425427

428+
// Try to delete all nodes that have no ingoing edges, starting from the
429+
// root. If there are any nodes left after this operation, then we have a
430+
// cycle. This relies on '--check-graph' not performing the topological sort.
426431
while (!Q.empty()) {
427432
Node* A = Q.front();
428433
Q.pop();
@@ -447,7 +452,6 @@ int CompilationGraph::CheckCycles() {
447452
return 0;
448453
}
449454

450-
451455
int CompilationGraph::Check () {
452456
// We try to catch as many errors as we can in one go.
453457
int ret = 0;

0 commit comments

Comments
 (0)