diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-22 17:28:03 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-22 17:28:03 +0000 |
commit | b90909e40536db17665727f5ca1c618e485464c3 (patch) | |
tree | 770b735b61c9866050ceb8d3705dc80a582d70a8 /lib/VMCore/Function.cpp | |
parent | 7aaa4a5c09d7c9a53ccf2c856c8ba6fe31f14302 (diff) |
For PR1136:
Add reference counting to ParamAttrsList and make use of it in Function,
CallInst and InvokeInst classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index b6ff70d6a3..e395366803 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -129,6 +129,10 @@ ParamAttrsList::get(const ParamAttrsVector &attrVec) { return PAL; } +ParamAttrsList::~ParamAttrsList() { + ParamAttrsLists->RemoveNode(this); +} + //===----------------------------------------------------------------------===// // Function Implementation //===----------------------------------------------------------------------===// @@ -162,6 +166,10 @@ Function::~Function() { // 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 @@ void Function::setParent(Module *parent) { 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()); } |