summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-11-18 00:50:08 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-11-18 00:50:08 +0000
commitfe81e3fb3cc0b2a45fd0dbf0d7ed077cf135535b (patch)
tree2d857f7e5b72e5ac7b3e5ba3dc777c34f2fcfce2 /clang/lib/CodeGen/CGCXX.cpp
parent5bbbb13765b152bba2c3f72703a95c46866037e6 (diff)
downloadbcm5719-llvm-fe81e3fb3cc0b2a45fd0dbf0d7ed077cf135535b.tar.gz
bcm5719-llvm-fe81e3fb3cc0b2a45fd0dbf0d7ed077cf135535b.zip
Refactor emitting call to delete operator into common function EmitDeleteCall.
llvm-svn: 89173
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 82f3cfefcab..8f5cff4efaf 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -1734,26 +1734,9 @@ void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD,
}
// If we have a deleting destructor, emit a call to the delete operator.
- if (DtorType == Dtor_Deleting) {
- const FunctionDecl *DeleteFD = DD->getOperatorDelete();
- assert(DeleteFD && "deleting dtor did not have a delete operator!");
-
- const FunctionProtoType *DeleteFTy =
- DeleteFD->getType()->getAs<FunctionProtoType>();
-
- CallArgList DeleteArgs;
-
- QualType ArgTy = DeleteFTy->getArgType(0);
- llvm::Value *DeletePtr = Builder.CreateBitCast(LoadCXXThis(),
- ConvertType(ArgTy));
- DeleteArgs.push_back(std::make_pair(RValue::get(DeletePtr), ArgTy));
-
- // Emit the call to delete.
- EmitCall(CGM.getTypes().getFunctionInfo(DeleteFTy->getResultType(),
- DeleteArgs),
- CGM.GetAddrOfFunction(DeleteFD),
- DeleteArgs, DeleteFD);
- }
+ if (DtorType == Dtor_Deleting)
+ EmitDeleteCall(DD->getOperatorDelete(), LoadCXXThis(),
+ getContext().getTagDeclType(ClassDecl));
}
void CodeGenFunction::SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
OpenPOWER on IntegriCloud