From 7e6d70a4251e66b7cf28a5c1282e1e1f49eebbfb Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Wed, 26 Nov 2008 22:59:45 +0000 Subject: Disallow multiple edges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60127 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvmc/driver/CompilationGraph.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tools/llvmc/driver/CompilationGraph.cpp') diff --git a/tools/llvmc/driver/CompilationGraph.cpp b/tools/llvmc/driver/CompilationGraph.cpp index 81283babb4..a4fda4834f 100644 --- a/tools/llvmc/driver/CompilationGraph.cpp +++ b/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-18-g5258