blob: 89203f18ca77550f421c215d5b30a5b96b81ff82 [file] [log] [blame]
Charles Davis071cc7d2010-08-16 03:33:14 +00001//===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This provides an abstract class for C++ AST support. Concrete
11// subclasses of this implement AST support for specific C++ ABIs.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_AST_CXXABI_H
16#define LLVM_CLANG_AST_CXXABI_H
17
Charles Davis424ae982010-10-29 03:25:11 +000018#include "clang/AST/Type.h"
19
Charles Davis071cc7d2010-08-16 03:33:14 +000020namespace clang {
21
22class ASTContext;
23class MemberPointerType;
Reid Kleckner942f9fe2013-09-10 20:14:30 +000024class MangleNumberingContext;
Charles Davis071cc7d2010-08-16 03:33:14 +000025
26/// Implements C++ ABI-specific semantic analysis functions.
27class CXXABI {
28public:
29 virtual ~CXXABI();
30
Reid Kleckner84e9ab42013-03-28 20:02:56 +000031 /// Returns the width and alignment of a member pointer in bits.
32 virtual std::pair<uint64_t, unsigned>
33 getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const = 0;
Charles Davis424ae982010-10-29 03:25:11 +000034
35 /// Returns the default calling convention for C++ methods.
Timur Iskhodzhanov8f88a1d2012-07-12 09:50:54 +000036 virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
Anders Carlssondae0cb52010-11-25 01:51:53 +000037
Reid Kleckner942f9fe2013-09-10 20:14:30 +000038 /// Returns whether the given class is nearly empty, with just virtual
39 /// pointers and no data except possibly virtual bases.
Anders Carlssondae0cb52010-11-25 01:51:53 +000040 virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
Reid Kleckner942f9fe2013-09-10 20:14:30 +000041
42 /// Returns a new mangling number context for this C++ ABI.
43 virtual MangleNumberingContext *createMangleNumberingContext() const = 0;
Charles Davis071cc7d2010-08-16 03:33:14 +000044};
45
46/// Creates an instance of a C++ ABI class.
John McCallee79a4c2010-08-21 22:46:04 +000047CXXABI *CreateARMCXXABI(ASTContext &Ctx);
Charles Davis071cc7d2010-08-16 03:33:14 +000048CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
49CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
50}
51
52#endif