Path: blob/main/contrib/llvm-project/clang/lib/AST/CXXABI.h
35260 views
//===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This provides an abstract class for C++ AST support. Concrete9// subclasses of this implement AST support for specific C++ ABIs.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_CLANG_LIB_AST_CXXABI_H14#define LLVM_CLANG_LIB_AST_CXXABI_H1516#include "clang/AST/Type.h"1718namespace clang {1920class ASTContext;21class CXXConstructorDecl;22class DeclaratorDecl;23class MangleContext;24class MangleNumberingContext;25class MemberPointerType;2627/// Implements C++ ABI-specific semantic analysis functions.28class CXXABI {29public:30virtual ~CXXABI();3132struct MemberPointerInfo {33uint64_t Width;34unsigned Align;35bool HasPadding;36};3738/// Returns the width and alignment of a member pointer in bits, as well as39/// whether it has padding.40virtual MemberPointerInfo41getMemberPointerInfo(const MemberPointerType *MPT) const = 0;4243/// Returns the default calling convention for C++ methods.44virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;4546/// Returns whether the given class is nearly empty, with just virtual47/// pointers and no data except possibly virtual bases.48virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;4950/// Returns a new mangling number context for this C++ ABI.51virtual std::unique_ptr<MangleNumberingContext>52createMangleNumberingContext() const = 0;5354/// Adds a mapping from class to copy constructor for this C++ ABI.55virtual void addCopyConstructorForExceptionObject(CXXRecordDecl *,56CXXConstructorDecl *) = 0;5758/// Retrieves the mapping from class to copy constructor for this C++ ABI.59virtual const CXXConstructorDecl *60getCopyConstructorForExceptionObject(CXXRecordDecl *) = 0;6162virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD,63TypedefNameDecl *DD) = 0;6465virtual TypedefNameDecl *66getTypedefNameForUnnamedTagDecl(const TagDecl *TD) = 0;6768virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD,69DeclaratorDecl *DD) = 0;7071virtual DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD) = 0;72};7374/// Creates an instance of a C++ ABI class.75CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);76CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);77std::unique_ptr<MangleNumberingContext>78createItaniumNumberingContext(MangleContext *);79}8081#endif828384