Add CallGraphEditor helper class and use it in the inliner.

Swift SVN r27008
This commit is contained in:
Mark Lacey
2015-04-05 04:30:08 +00:00
parent 93198d4b92
commit bad8678f89
3 changed files with 29 additions and 5 deletions

View File

@@ -523,6 +523,23 @@ void CallGraph::verify() const {
#endif
}
void CallGraphEditor::replaceApplyWithNew(FullApplySite Old,
FullApplySite New) {
if (auto *Edge = CG.getCallGraphEdge(Old))
CG.removeEdge(Edge);
CG.addEdgesForApply(New);
}
void CallGraphEditor::replaceApplyWithNew(FullApplySite Old,
llvm::SmallVectorImpl<FullApplySite> &NewApplies) {
if (auto *Edge = CG.getCallGraphEdge(Old))
CG.removeEdge(Edge);
for (auto NewApply : NewApplies)
CG.addEdgesForApply(NewApply);
}
void CallGraphAnalysis::verify() const {
#ifndef NDEBUG
// If we don't have a callgraph, return.