diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-09 18:00:57 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-09 18:00:57 +0000 |
commit | fa3e91242fada931ccb96468ac4c93ca151d64dc (patch) | |
tree | 5abb5932596d8960088aafe289eb94176a6f9f39 /lib/VMCore/Instructions.cpp | |
parent | 3aad26e4da495178885ed0841996fb1dd4a17de5 (diff) | |
download | external_llvm-fa3e91242fada931ccb96468ac4c93ca151d64dc.zip external_llvm-fa3e91242fada931ccb96468ac4c93ca151d64dc.tar.gz external_llvm-fa3e91242fada931ccb96468ac4c93ca151d64dc.tar.bz2 |
For 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index c09ec3c..f9aa3e7 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -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 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const { 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(Value *Func, const std::string &Name, 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 @@ CallInst::CallInst(const CallInst &CI) 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(Value *Fn, BasicBlock *IfNormal, 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) |