clang  14.0.0git
CXXABI.h
Go to the documentation of this file.
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.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_AST_CXXABI_H
15 #define LLVM_CLANG_LIB_AST_CXXABI_H
16 
17 #include "clang/AST/Type.h"
18 
19 namespace clang {
20 
21 class ASTContext;
22 class CXXConstructorDecl;
23 class DeclaratorDecl;
24 class Expr;
25 class MangleContext;
26 class MangleNumberingContext;
27 class MemberPointerType;
28 
29 /// Implements C++ ABI-specific semantic analysis functions.
30 class CXXABI {
31 public:
32  virtual ~CXXABI();
33 
35  uint64_t Width;
36  unsigned Align;
37  bool HasPadding;
38  };
39 
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;
44 
45  /// Returns the default calling convention for C++ methods.
46  virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
47 
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;
51 
52  /// Returns a new mangling number context for this C++ ABI.
53  virtual std::unique_ptr<MangleNumberingContext>
54  createMangleNumberingContext() const = 0;
55 
56  /// Adds a mapping from class to copy constructor for this C++ ABI.
58  CXXConstructorDecl *) = 0;
59 
60  /// Retrieves the mapping from class to copy constructor for this C++ ABI.
61  virtual const CXXConstructorDecl *
63 
65  TypedefNameDecl *DD) = 0;
66 
67  virtual TypedefNameDecl *
69 
70  virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD,
71  DeclaratorDecl *DD) = 0;
72 
74 };
75 
76 /// Creates an instance of a C++ ABI class.
79 std::unique_ptr<MangleNumberingContext>
81 }
82 
83 #endif
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2401
clang::CXXABI::getCopyConstructorForExceptionObject
virtual const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *)=0
Retrieves the mapping from class to copy constructor for this C++ ABI.
clang::CXXABI::MemberPointerInfo
Definition: CXXABI.h:34
clang::CXXABI::getDefaultMethodCallConv
virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const =0
Returns the default calling convention for C++ methods.
clang::CXXABI::MemberPointerInfo::Align
unsigned Align
Definition: CXXABI.h:36
clang::CXXABI::isNearlyEmpty
virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const =0
Returns whether the given class is nearly empty, with just virtual pointers and no data except possib...
clang::CXXABI::~CXXABI
virtual ~CXXABI()
clang::CXXABI::getMemberPointerInfo
virtual MemberPointerInfo getMemberPointerInfo(const MemberPointerType *MPT) const =0
Returns the width and alignment of a member pointer in bits, as well as whether it has padding.
clang::MangleContext
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Definition: Mangle.h:44
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
Type.h
clang::CallingConv
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:263
clang::CXXABI::MemberPointerInfo::HasPadding
bool HasPadding
Definition: CXXABI.h:37
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3328
clang::CXXABI
Implements C++ ABI-specific semantic analysis functions.
Definition: CXXABI.h:30
clang::CreateMicrosoftCXXABI
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
Definition: MicrosoftCXXABI.cpp:317
clang::CXXABI::MemberPointerInfo::Width
uint64_t Width
Definition: CXXABI.h:35
clang::CXXABI::addTypedefNameForUnnamedTagDecl
virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *DD)=0
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::CXXABI::getDeclaratorForUnnamedTagDecl
virtual DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)=0
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:728
clang::CXXABI::addCopyConstructorForExceptionObject
virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *, CXXConstructorDecl *)=0
Adds a mapping from class to copy constructor for this C++ ABI.
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2831
clang::CreateItaniumCXXABI
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
Definition: ItaniumCXXABI.cpp:292
clang
Definition: CalledOnceCheck.h:17
clang::CXXABI::addDeclaratorForUnnamedTagDecl
virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)=0
clang::TypedefNameDecl
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3180
clang::CXXABI::createMangleNumberingContext
virtual std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const =0
Returns a new mangling number context for this C++ ABI.
clang::createItaniumNumberingContext
std::unique_ptr< MangleNumberingContext > createItaniumNumberingContext(MangleContext *)
Definition: ItaniumCXXABI.cpp:297
clang::CXXABI::getTypedefNameForUnnamedTagDecl
virtual TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)=0