From 6f4cb52c71af0f7066bd82cd3f45c246d2735321 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Wed, 26 Nov 2008 22:59:45 +0000 Subject: Disallow multiple edges. llvm-svn: 60127 --- llvm/tools/llvmc/driver/CompilationGraph.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'llvm/tools/llvmc/driver/CompilationGraph.cpp') diff --git a/llvm/tools/llvmc/driver/CompilationGraph.cpp b/llvm/tools/llvmc/driver/CompilationGraph.cpp index 81283babb48..a4fda4834fc 100644 --- a/llvm/tools/llvmc/driver/CompilationGraph.cpp +++ b/llvm/tools/llvmc/driver/CompilationGraph.cpp @@ -79,6 +79,20 @@ namespace { } +void Node::AddEdge(Edge* Edg) { + // If there already was an edge between two nodes, modify it instead + // of adding a new edge. + const std::string& ToolName = Edg->ToolName(); + for (container_type::iterator B = OutEdges.begin(), E = OutEdges.end(); + B != E; ++B) { + if ((*B)->ToolName() == ToolName) { + llvm::IntrusiveRefCntPtr(Edg).swap(*B); + return; + } + } + OutEdges.push_back(llvm::IntrusiveRefCntPtr(Edg)); +} + CompilationGraph::CompilationGraph() { NodesMap["root"] = Node(this); } -- cgit v1.2.3