[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp

Reid Spencer reid at x10sys.com
Mon Apr 9 11:01:14 PDT 2007



Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.82 -> 1.83
---
Log message:

For PR1146: http://llvm.org/PR1146 :
* Add ParamAttrs to InvokeInst class too.
* Make sure all initializes of ParamAttrs in CallInst and InvokeInst are 0
* Destruct the ParamAttrs in Call/Invoke destructors to avoid memory 
  leaks. This will change when ParamAttrsList is uniquified but needs to
  be correct until then.


---
Diffs of the changes:  (+6 -0)

 Instructions.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.82 llvm/lib/VMCore/Instructions.cpp:1.83
--- llvm/lib/VMCore/Instructions.cpp:1.82	Mon Apr  9 10:01:12 2007
+++ llvm/lib/VMCore/Instructions.cpp	Mon Apr  9 13:00:57 2007
@@ -17,6 +17,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
+#include "llvm/ParameterAttributes.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/ConstantRange.h"
 using namespace llvm;
@@ -185,6 +186,7 @@
 
 CallInst::~CallInst() {
   delete [] OperandList;
+  delete ParamAttrs; // FIXME: ParamAttrsList should be uniqued!
 }
 
 void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
@@ -337,6 +339,7 @@
 CallInst::CallInst(const CallInst &CI)
   : Instruction(CI.getType(), Instruction::Call, new Use[CI.getNumOperands()],
                 CI.getNumOperands()) {
+  ParamAttrs = 0;
   SubclassData = CI.SubclassData;
   Use *OL = OperandList;
   Use *InOL = CI.OperandList;
@@ -351,10 +354,12 @@
 
 InvokeInst::~InvokeInst() {
   delete [] OperandList;
+  delete ParamAttrs; // FIXME: ParamAttrsList should be uniqued!
 }
 
 void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
                       Value* const *Args, unsigned NumArgs) {
+  ParamAttrs = 0;
   NumOperands = 3+NumArgs;
   Use *OL = OperandList = new Use[3+NumArgs];
   OL[0].init(Fn, this);
@@ -402,6 +407,7 @@
 InvokeInst::InvokeInst(const InvokeInst &II)
   : TerminatorInst(II.getType(), Instruction::Invoke,
                    new Use[II.getNumOperands()], II.getNumOperands()) {
+  ParamAttrs = 0;
   SubclassData = II.SubclassData;
   Use *OL = OperandList, *InOL = II.OperandList;
   for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i)






More information about the llvm-commits mailing list