clang 20.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
19namespace clang {
20
21class ASTContext;
22class CXXConstructorDecl;
23class DeclaratorDecl;
24class MangleContext;
25class MangleNumberingContext;
26class MemberPointerType;
27
28/// Implements C++ ABI-specific semantic analysis functions.
29class CXXABI {
30public:
31 virtual ~CXXABI();
32
34 uint64_t Width;
35 unsigned Align;
37 };
38
39 /// Returns the width and alignment of a member pointer in bits, as well as
40 /// whether it has padding.
41 virtual MemberPointerInfo
43
44 /// Returns the default calling convention for C++ methods.
45 virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
46
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;
50
51 /// Returns a new mangling number context for this C++ ABI.
52 virtual std::unique_ptr<MangleNumberingContext>
54
55 /// Adds a mapping from class to copy constructor for this C++ ABI.
57 CXXConstructorDecl *) = 0;
58
59 /// Retrieves the mapping from class to copy constructor for this C++ ABI.
60 virtual const CXXConstructorDecl *
62
64 TypedefNameDecl *DD) = 0;
65
66 virtual TypedefNameDecl *
68
70 DeclaratorDecl *DD) = 0;
71
73};
74
75/// Creates an instance of a C++ ABI class.
78std::unique_ptr<MangleNumberingContext>
80}
81
82#endif
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
Implements C++ ABI-specific semantic analysis functions.
Definition: CXXABI.h:29
virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *DD)=0
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.
virtual std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const =0
Returns a new mangling number context for this C++ ABI.
virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const =0
Returns the default calling convention for C++ methods.
virtual ~CXXABI()
virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)=0
virtual TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)=0
virtual const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *)=0
Retrieves the mapping from class to copy constructor for this C++ ABI.
virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *, CXXConstructorDecl *)=0
Adds a mapping from class to copy constructor for this C++ ABI.
virtual DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)=0
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...
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2553
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:735
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Definition: Mangle.h:45
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:3519
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3564
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3413
The JSON file list parser is used to communicate input to InstallAPI.
std::unique_ptr< MangleNumberingContext > createItaniumNumberingContext(MangleContext *)
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:278