clang API Documentation

CXXABI.h
Go to the documentation of this file.
00001 //===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This provides an abstract class for C++ AST support. Concrete
00011 // subclasses of this implement AST support for specific C++ ABIs.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CLANG_LIB_AST_CXXABI_H
00016 #define LLVM_CLANG_LIB_AST_CXXABI_H
00017 
00018 #include "clang/AST/Type.h"
00019 
00020 namespace clang {
00021 
00022 class ASTContext;
00023 class MemberPointerType;
00024 class MangleNumberingContext;
00025 
00026 /// Implements C++ ABI-specific semantic analysis functions.
00027 class CXXABI {
00028 public:
00029   virtual ~CXXABI();
00030 
00031   /// Returns the width and alignment of a member pointer in bits.
00032   virtual std::pair<uint64_t, unsigned>
00033   getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const = 0;
00034 
00035   /// Returns the default calling convention for C++ methods.
00036   virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
00037 
00038   /// Returns whether the given class is nearly empty, with just virtual
00039   /// pointers and no data except possibly virtual bases.
00040   virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
00041 
00042   /// Returns a new mangling number context for this C++ ABI.
00043   virtual MangleNumberingContext *createMangleNumberingContext() const = 0;
00044 };
00045 
00046 /// Creates an instance of a C++ ABI class.
00047 CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
00048 CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
00049 }
00050 
00051 #endif