TemplateOrInstantiation = Template;
}
+ /// getDestructor - Returns the destructor decl for this class.
+ const CXXDestructorDecl *getDestructor(ASTContext &Context);
+
/// viewInheritance - Renders and displays an inheritance diagram
/// for this C++ class and all of its base classes (transitively) using
/// GraphViz.
Conversions.addOverload(ConvDecl);
}
+const CXXDestructorDecl *
+CXXRecordDecl::getDestructor(ASTContext &Context) {
+ QualType ClassType = Context.getTypeDeclType(this);
+
+ DeclarationName Name
+ = Context.DeclarationNames.getCXXDestructorName(ClassType);
+
+ DeclContext::lookup_iterator I, E;
+ llvm::tie(I, E) = lookup(Context, Name);
+ assert(I != E && "Did not find a destructor!");
+
+ const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(*I);
+ assert(++I == E && "Found more than one destructor!");
+
+ return Dtor;
+}
+
CXXMethodDecl *
CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
EmitCXXMemberCall(D, Callee, This, ArgBeg, ArgEnd);
}
+void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *D,
+ CXXDtorType Type,
+ llvm::Value *This) {
+ llvm::Value *Callee = CGM.GetAddrOfCXXDestructor(D, Type);
+
+ EmitCXXMemberCall(D, Callee, This, 0, 0);
+}
+
void
CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
const CXXConstructExpr *E) {
namespace clang {
class ASTContext;
+ class CXXDestructorDecl;
class Decl;
class EnumConstantDecl;
class FunctionDecl;
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd);
+ void EmitCXXDestructorCall(const CXXDestructorDecl *D, CXXDtorType Type,
+ llvm::Value *This);
+
//===--------------------------------------------------------------------===//
// Declaration Emission
//===--------------------------------------------------------------------===//
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
EmitCXXConstructor(CD, GD.getCtorType());
+ else if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))
+ EmitCXXDestructor(DD, GD.getDtorType());
else if (isa<FunctionDecl>(D))
EmitGlobalFunctionDefinition(GD);
else if (const VarDecl *VD = dyn_cast<VarDecl>(D))