Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 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 | |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 15 | #ifndef LLVM_CLANG_LIB_AST_CXXABI_H |
| 16 | #define LLVM_CLANG_LIB_AST_CXXABI_H |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 17 | |
Charles Davis | 424ae98 | 2010-10-29 03:25:11 +0000 | [diff] [blame] | 18 | #include "clang/AST/Type.h" |
| 19 | |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 20 | namespace clang { |
| 21 | |
| 22 | class ASTContext; |
| 23 | class MemberPointerType; |
Reid Kleckner | 942f9fe | 2013-09-10 20:14:30 +0000 | [diff] [blame] | 24 | class MangleNumberingContext; |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 25 | |
| 26 | /// Implements C++ ABI-specific semantic analysis functions. |
| 27 | class CXXABI { |
| 28 | public: |
| 29 | virtual ~CXXABI(); |
| 30 | |
Reid Kleckner | 84e9ab4 | 2013-03-28 20:02:56 +0000 | [diff] [blame] | 31 | /// 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 Davis | 424ae98 | 2010-10-29 03:25:11 +0000 | [diff] [blame] | 34 | |
| 35 | /// Returns the default calling convention for C++ methods. |
Timur Iskhodzhanov | 8f88a1d | 2012-07-12 09:50:54 +0000 | [diff] [blame] | 36 | virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0; |
Anders Carlsson | dae0cb5 | 2010-11-25 01:51:53 +0000 | [diff] [blame] | 37 | |
Reid Kleckner | 942f9fe | 2013-09-10 20:14:30 +0000 | [diff] [blame] | 38 | /// Returns whether the given class is nearly empty, with just virtual |
| 39 | /// pointers and no data except possibly virtual bases. |
Anders Carlsson | dae0cb5 | 2010-11-25 01:51:53 +0000 | [diff] [blame] | 40 | virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0; |
Reid Kleckner | 942f9fe | 2013-09-10 20:14:30 +0000 | [diff] [blame] | 41 | |
| 42 | /// Returns a new mangling number context for this C++ ABI. |
| 43 | virtual MangleNumberingContext *createMangleNumberingContext() const = 0; |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | /// Creates an instance of a C++ ABI class. |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 47 | CXXABI *CreateItaniumCXXABI(ASTContext &Ctx); |
| 48 | CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx); |
| 49 | } |
| 50 | |
| 51 | #endif |