CXXABI.h revision 218893
1//===----- 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
18#include "clang/AST/Type.h"
19
20namespace clang {
21
22class ASTContext;
23class MemberPointerType;
24
25/// Implements C++ ABI-specific semantic analysis functions.
26class CXXABI {
27public:
28  virtual ~CXXABI();
29
30  /// Returns the size of a member pointer in multiples of the target
31  /// pointer size.
32  virtual unsigned getMemberPointerSize(const MemberPointerType *MPT) const = 0;
33
34  /// Returns the default calling convention for C++ methods.
35  virtual CallingConv getDefaultMethodCallConv() const = 0;
36
37  // Returns whether the given class is nearly empty, with just virtual pointers
38  // and no data except possibly virtual bases.
39  virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
40};
41
42/// Creates an instance of a C++ ABI class.
43CXXABI *CreateARMCXXABI(ASTContext &Ctx);
44CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
45CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
46}
47
48#endif
49