diff options
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()); } |