From eff0da9d33b0067044638b9e53edf462a96e6eab Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 21 Oct 2002 15:32:34 +0000 Subject: [PATCH] Add another copy ctor form git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4251 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DSGraph.h | 7 ++++++- include/llvm/Analysis/DataStructure/DSGraph.h | 7 ++++++- lib/Analysis/DataStructure/DataStructure.cpp | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h index 9324cb7a3c7..2a683655851 100644 --- a/include/llvm/Analysis/DSGraph.h +++ b/include/llvm/Analysis/DSGraph.h @@ -473,7 +473,12 @@ class DSGraph { public: DSGraph() : Func(0) {} // Create a new, empty, DSGraph. DSGraph(Function &F); // Compute the local DSGraph - DSGraph(const DSGraph &DSG); // Copy ctor + + // Copy ctor - If you want to capture the node mapping between the source and + // destination graph, you may optionally do this by specifying a map to record + // this into. + DSGraph(const DSGraph &DSG); + DSGraph(const DSGraph &DSG, std::map &BUNodeMapTy); ~DSGraph(); bool hasFunction() const { return Func != 0; } diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 9324cb7a3c7..2a683655851 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -473,7 +473,12 @@ class DSGraph { public: DSGraph() : Func(0) {} // Create a new, empty, DSGraph. DSGraph(Function &F); // Compute the local DSGraph - DSGraph(const DSGraph &DSG); // Copy ctor + + // Copy ctor - If you want to capture the node mapping between the source and + // destination graph, you may optionally do this by specifying a map to record + // this into. + DSGraph(const DSGraph &DSG); + DSGraph(const DSGraph &DSG, std::map &BUNodeMapTy); ~DSGraph(); bool hasFunction() const { return Func != 0; } diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index cc0b8d8fc5a..4b3be84aaf5 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -371,6 +371,11 @@ DSGraph::DSGraph(const DSGraph &G) : Func(G.Func) { RetNode = cloneInto(G, ValueMap, NodeMap); } +DSGraph::DSGraph(const DSGraph &G, std::map &NodeMap) + : Func(G.Func) { + RetNode = cloneInto(G, ValueMap, NodeMap); +} + DSGraph::~DSGraph() { FunctionCalls.clear(); ValueMap.clear();