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_AST_CXXABI_H
00016 #define LLVM_CLANG_AST_CXXABI_H
00017 
00018 #include "clang/AST/Type.h"
00019 
00020 namespace clang {
00021 
00022 class ASTContext;
00023 class MemberPointerType;
00024 
00025 /// Implements C++ ABI-specific semantic analysis functions.
00026 class CXXABI {
00027 public:
00028   virtual ~CXXABI();
00029 
00030   /// Returns the size of a member pointer in multiples of the target
00031   /// pointer size.
00032   virtual unsigned getMemberPointerSize(const MemberPointerType *MPT) const = 0;
00033 
00034   /// Returns the default calling convention for C++ methods.
00035   virtual CallingConv getDefaultMethodCallConv() const = 0;
00036 
00037   // Returns whether the given class is nearly empty, with just virtual pointers
00038   // and no data except possibly virtual bases.
00039   virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
00040 };
00041 
00042 /// Creates an instance of a C++ ABI class.
00043 CXXABI *CreateARMCXXABI(ASTContext &Ctx);
00044 CXXABI *CreateItaniumCXXABI(ASTContext &Ctx);
00045 CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx);
00046 }
00047 
00048 #endif