[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / lib / AST / CXXABI.h
blob9258a53fefebcbd699fa2e3511e19e6547bab698
1 //===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This provides an abstract class for C++ AST support. Concrete
10 // subclasses of this implement AST support for specific C++ ABIs.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_AST_CXXABI_H
15 #define LLVM_CLANG_LIB_AST_CXXABI_H
17 #include "clang/AST/Type.h"
19 namespace clang {
21 class ASTContext;
22 class CXXConstructorDecl;
23 class DeclaratorDecl;
24 class MangleContext;
25 class MangleNumberingContext;
26 class MemberPointerType;
28 /// Implements C++ ABI-specific semantic analysis functions.
29 class CXXABI {
30 public:
31 virtual ~CXXABI();
33 struct MemberPointerInfo {
34 uint64_t Width;
35 unsigned Align;
36 bool HasPadding;
39 /// Returns the width and alignment of a member pointer in bits, as well as
40 /// whether it has padding.
41 virtual MemberPointerInfo
42 getMemberPointerInfo(const MemberPointerType *MPT) const = 0;
44 /// Returns the default calling convention for C++ methods.
45 virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
47 /// Returns whether the given class is nearly empty, with just virtual
48 /// pointers and no data except possibly virtual bases.
49 virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
51 /// Returns a new mangling number context for this C++ ABI.
52 virtual std::unique_ptr<MangleNumberingContext>
53 createMangleNumberingContext() const = 0;
55 /// Adds a mapping from class to copy constructor for this C++ ABI.
56 virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *,
57 CXXConstructorDecl *) = 0;
59 /// Retrieves the mapping from class to copy constructor for this C++ ABI.
60 virtual const CXXConstructorDecl *
61 getCopyConstructorForExceptionObject(CXXRecordDecl *) = 0;
63 virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD,
64 TypedefNameDecl *DD) = 0;
66 virtual TypedefNameDecl *
67 getTypedefNameForUnnamedTagDecl(const TagDecl *TD) = 0;
69 virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD,
70 DeclaratorDecl *DD) = 0;
72 virtual DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD) = 0;
75 /// Creates an instance of a C++ ABI class.
76 CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
77 CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
78 std::unique_ptr<MangleNumberingContext>
79 createItaniumNumberingContext(MangleContext *);
82 #endif