Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.125 -> 1.126 Instructions.cpp updated: 1.88 -> 1.89 --- Log message: For PR1136: http://llvm.org/PR1136 : Add reference counting to ParamAttrsList and make use of it in Function, CallInst and InvokeInst classes. --- Diffs of the changes: (+40 -0) Function.cpp | 18 ++++++++++++++++++ Instructions.cpp | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.125 llvm/lib/VMCore/Function.cpp:1.126 --- llvm/lib/VMCore/Function.cpp:1.125 Sun Apr 22 00:46:44 2007 +++ llvm/lib/VMCore/Function.cpp Sun Apr 22 12:28:03 2007 @@ -129,6 +129,10 @@ return PAL; } +ParamAttrsList::~ParamAttrsList() { + ParamAttrsLists->RemoveNode(this); +} + //===----------------------------------------------------------------------===// // Function Implementation //===----------------------------------------------------------------------===// @@ -162,6 +166,10 @@ // Delete all of the method arguments and unlink from symbol table... ArgumentList.clear(); delete SymTab; + + // Drop our reference to the parameter attributes, if any. + if (ParamAttrs) + ParamAttrs->dropRef(); } void Function::setParent(Module *parent) { @@ -172,6 +180,16 @@ LeakDetector::removeGarbageObject(this); } +void Function::setParamAttrs(ParamAttrsList *attrs) { + if (ParamAttrs) + ParamAttrs->dropRef(); + + if (attrs) + attrs->addRef(); + + ParamAttrs = attrs; +} + const FunctionType *Function::getFunctionType() const { return cast<FunctionType>(getType()->getElementType()); } Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.88 llvm/lib/VMCore/Instructions.cpp:1.89 --- llvm/lib/VMCore/Instructions.cpp:1.88 Sun Apr 22 00:46:44 2007 +++ llvm/lib/VMCore/Instructions.cpp Sun Apr 22 12:28:03 2007 @@ -186,6 +186,8 @@ CallInst::~CallInst() { delete [] OperandList; + if (ParamAttrs) + ParamAttrs->dropRef(); } void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) { @@ -346,6 +348,15 @@ OL[i].init(InOL[i], this); } +void CallInst::setParamAttrs(ParamAttrsList *newAttrs) { + if (ParamAttrs) + ParamAttrs->dropRef(); + + if (newAttrs) + newAttrs->addRef(); + + ParamAttrs = newAttrs; +} //===----------------------------------------------------------------------===// // InvokeInst Implementation @@ -353,6 +364,8 @@ InvokeInst::~InvokeInst() { delete [] OperandList; + if (ParamAttrs) + ParamAttrs->dropRef(); } void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, @@ -422,6 +435,15 @@ return setSuccessor(idx, B); } +void InvokeInst::setParamAttrs(ParamAttrsList *newAttrs) { + if (ParamAttrs) + ParamAttrs->dropRef(); + + if (newAttrs) + newAttrs->addRef(); + + ParamAttrs = newAttrs; +} //===----------------------------------------------------------------------===// // ReturnInst Implementation _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits