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 | c6a83847a2ee2ecec9e8404c307e0a6e122350a0 (patch) | |
tree | 6d6573231aaa53ffde0d8f6f9245fd201832be8e /llvm/lib/VMCore/Function.cpp | |
parent | 380058025b51c6989572debdb65aaa93ce81e22c (diff) | |
download | bcm5719-llvm-c6a83847a2ee2ecec9e8404c307e0a6e122350a0.tar.gz bcm5719-llvm-c6a83847a2ee2ecec9e8404c307e0a6e122350a0.zip |
For PR1136:
Add reference counting to ParamAttrsList and make use of it in Function,
CallInst and InvokeInst classes.
llvm-svn: 36346
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r-- | llvm/lib/VMCore/Function.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index b6ff70d6a33..e3953668032 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/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()); } |