As it turns out, we don't need a fully generic mapping copy ctor, we just need

something that maps through a std::map.  Since this simplified the client and
implementation code, do so now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-10-21 15:04:18 +00:00
parent 448f4949dc
commit 99a22847ba
4 changed files with 70 additions and 56 deletions

View File

@ -361,18 +361,6 @@ Function &DSCallSite::getCaller() const {
return *Inst->getParent()->getParent();
}
template <typename CopyFunctor>
DSCallSite::DSCallSite(const DSCallSite &FromCall, CopyFunctor nodeCopier)
: Inst(FromCall.Inst) {
RetVal = nodeCopier(&FromCall.RetVal);
Callee = nodeCopier(&FromCall.Callee);
CallArgs.reserve(FromCall.CallArgs.size());
for (unsigned j = 0, ej = FromCall.CallArgs.size(); j != ej; ++j)
CallArgs.push_back(nodeCopier(&FromCall.CallArgs[j]));
}
//===----------------------------------------------------------------------===//
// DSGraph Implementation
@ -402,11 +390,6 @@ DSGraph::~DSGraph() {
void DSGraph::dump() const { print(std::cerr); }
static DSNodeHandle copyHelper(const DSNodeHandle* fromNode,
std::map<const DSNode*, DSNode*> *NodeMap) {
return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset());
}
// Helper function used to clone a function list.
//
static void CopyFunctionCallsList(const vector<DSCallSite>& fromCalls,
@ -415,8 +398,7 @@ static void CopyFunctionCallsList(const vector<DSCallSite>& fromCalls,
unsigned FC = toCalls.size(); // FirstCall
toCalls.reserve(FC+fromCalls.size());
for (unsigned i = 0, ei = fromCalls.size(); i != ei; ++i)
toCalls.push_back(DSCallSite(fromCalls[i],
std::bind2nd(std::ptr_fun(&copyHelper), &NodeMap)));
toCalls.push_back(DSCallSite(fromCalls[i], NodeMap));
}
/// remapLinks - Change all of the Links in the current node according to the