[llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp

Chris Lattner sabre at nondot.org
Mon Dec 4 13:23:00 PST 2006



Changes in directory llvm/lib/Analysis/IPA:

CallGraph.cpp updated: 1.59 -> 1.60
---
Log message:

Add a comment and fix a memory leak.  Thanks to Vikram for pointing this out.


---
Diffs of the changes:  (+5 -4)

 CallGraph.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Analysis/IPA/CallGraph.cpp
diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.59 llvm/lib/Analysis/IPA/CallGraph.cpp:1.60
--- llvm/lib/Analysis/IPA/CallGraph.cpp:1.59	Tue Nov 28 18:19:40 2006
+++ llvm/lib/Analysis/IPA/CallGraph.cpp	Mon Dec  4 15:22:45 2006
@@ -20,6 +20,9 @@
 #include <ostream>
 using namespace llvm;
 
+/// isOnlyADirectCall - Return true if this callsite is *just* a direct call to
+/// the specified function.  Specifically return false if the callsite also
+/// takes the address of the function.
 static bool isOnlyADirectCall(Function *F, CallSite CS) {
   if (!CS.getInstruction()) return false;
   for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I)
@@ -179,10 +182,8 @@
   //
   // destroy - Release memory for the call graph
   virtual void destroy() {
-    if (!CallsExternalNode) {
-      delete CallsExternalNode;
-      CallsExternalNode = 0;
-    }
+    delete CallsExternalNode;
+    CallsExternalNode = 0;
   }
 };
 






More information about the llvm-commits mailing list