From ed455c8fa25dd37a13b33f0afa66be03ac49b5bb Mon Sep 17 00:00:00 2001 From: Gordon Henriksen Date: Sun, 9 Dec 2007 22:46:10 +0000 Subject: Devirtualizing Value destructor (PR889). Patch by Pawel Kunio! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44747 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Function.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/VMCore/Function.cpp') diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 04db3aa06c..b1405e5926 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -287,16 +287,17 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, ParentModule->getFunctionList().push_back(this); } -Function::~Function() { - dropAllReferences(); // After this it is safe to delete instructions. +void Function::destroyThis(Function*v) { + v->dropAllReferences(); // After this it is safe to delete instructions. // Delete all of the method arguments and unlink from symbol table... - ArgumentList.clear(); - delete SymTab; + v->ArgumentList.clear(); + delete v->SymTab; // Drop our reference to the parameter attributes, if any. - if (ParamAttrs) - ParamAttrs->dropRef(); + if (v->ParamAttrs) + v->ParamAttrs->dropRef(); + GlobalValue::destroyThis(v); } void Function::BuildLazyArguments() const { -- cgit v1.2.3