Add CallGraphNode::removeAnyCallEdgeTo method
authorChris Lattner <sabre@nondot.org>
Sat, 18 Sep 2004 21:34:34 +0000 (21:34 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Sep 2004 21:34:34 +0000 (21:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16398 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/CallGraph.h
lib/Analysis/IPA/CallGraph.cpp

index 4b4db6bd6082e5e1783f134c10ed5fad70501603..8f2c30238907e73e9e69a52c2889e3090ca862ba 100644 (file)
@@ -251,6 +251,11 @@ public:
   /// used sparingly.
   void removeCallEdgeTo(CallGraphNode *Callee);
 
+  /// removeAnyCallEdgeTo - This method removes any call edges from this node to
+  /// the specified callee function.  This takes more time to execute than
+  /// removeCallEdgeTo, so it should not be used unless necessary.
+  void removeAnyCallEdgeTo(CallGraphNode *Callee);
+
 private:                    // Stuff to construct the node, used by CallGraph
   friend class CallGraph;
 
index ac926dc59a14a26bbda837ced98746c49b0875bb..e3a60248895251e5f9b69d12fed651a5a705cbd4 100644 (file)
@@ -206,3 +206,15 @@ void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {
     }
   }
 }
+
+// removeAnyCallEdgeTo - This method removes any call edges from this node to
+// the specified callee function.  This takes more time to execute than
+// removeCallEdgeTo, so it should not be used unless necessary.
+void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) {
+  for (std::vector<CallGraphNode*>::iterator I = CalledFunctions.begin(),
+         E = CalledFunctions.end(); I != E; ++I)
+    if (*I == Callee) {
+      CalledFunctions.erase(I);
+      E = CalledFunctions.end();
+    }
+}