From 27ae53665f8b00fe4ba21da0fa79a4ce6e0b6cd5 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 17 Apr 2009 01:58:57 +0000 Subject: Add support for generating (very basic) C++ destructors. These aren't called by anything yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69343 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 469c637e2d..e7924fade5 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -56,6 +56,7 @@ namespace clang { class CompileOptions; class Diagnostic; class AnnotateAttr; + class CXXDestructorDecl; namespace CodeGen { @@ -240,6 +241,11 @@ public: /// given type. llvm::Function *GetAddrOfCXXConstructor(const CXXConstructorDecl *D, CXXCtorType Type); + + /// GetAddrOfCXXDestructor - Return the address of the constructor of the + /// given type. + llvm::Function *GetAddrOfCXXDestructor(const CXXDestructorDecl *D, + CXXDtorType Type); /// getBuiltinLibFunction - Given a builtin id for a function like /// "__builtin_fabsf", return a Function* for "fabsf". @@ -331,6 +337,8 @@ public: const char *getMangledName(const NamedDecl *ND); const char *getMangledCXXCtorName(const CXXConstructorDecl *D, CXXCtorType Type); + const char *getMangledCXXDtorName(const CXXDestructorDecl *D, + CXXDtorType Type); enum GVALinkage { GVA_Internal, @@ -392,6 +400,14 @@ private: /// a C++ constructor Decl. void EmitCXXConstructor(const CXXConstructorDecl *D, CXXCtorType Type); + /// EmitCXXDestructors - Emit destructors (base, complete) from a + /// C++ destructor Decl. + void EmitCXXDestructors(const CXXDestructorDecl *D); + + /// EmitCXXDestructor - Emit a single destructor with the given type from + /// a C++ destructor Decl. + void EmitCXXDestructor(const CXXDestructorDecl *D, CXXDtorType Type); + // FIXME: Hardcoding priority here is gross. void AddGlobalCtor(llvm::Function * Ctor, int Priority=65535); void AddGlobalDtor(llvm::Function * Dtor, int Priority=65535); -- cgit v1.2.3