1 //===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This provides an abstract class for C++ AST support. Concrete
11 // subclasses of this implement AST support for specific C++ ABIs.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_LIB_AST_CXXABI_H
16 #define LLVM_CLANG_LIB_AST_CXXABI_H
18 #include "clang/AST/Type.h"
23 class CXXConstructorDecl;
26 class MemberPointerType;
27 class MangleNumberingContext;
29 /// Implements C++ ABI-specific semantic analysis functions.
34 struct MemberPointerInfo {
40 /// Returns the width and alignment of a member pointer in bits, as well as
41 /// whether it has padding.
42 virtual MemberPointerInfo
43 getMemberPointerInfo(const MemberPointerType *MPT) const = 0;
45 /// Returns the default calling convention for C++ methods.
46 virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
48 /// Returns whether the given class is nearly empty, with just virtual
49 /// pointers and no data except possibly virtual bases.
50 virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
52 /// Returns a new mangling number context for this C++ ABI.
53 virtual std::unique_ptr<MangleNumberingContext>
54 createMangleNumberingContext() const = 0;
56 /// Adds a mapping from class to copy constructor for this C++ ABI.
57 virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *,
58 CXXConstructorDecl *) = 0;
60 /// Retrieves the mapping from class to copy constructor for this C++ ABI.
61 virtual const CXXConstructorDecl *
62 getCopyConstructorForExceptionObject(CXXRecordDecl *) = 0;
64 virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD,
65 TypedefNameDecl *DD) = 0;
67 virtual TypedefNameDecl *
68 getTypedefNameForUnnamedTagDecl(const TagDecl *TD) = 0;
70 virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD,
71 DeclaratorDecl *DD) = 0;
73 virtual DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD) = 0;
76 /// Creates an instance of a C++ ABI class.
77 CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
78 CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);