1 //===------- ItaniumCXXABI.cpp - AST support for the Itanium C++ ABI ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This provides C++ AST support targetting the Itanium C++ ABI, which is
12 // http://www.codesourcery.com/public/cxx-abi/abi.html
13 // http://www.codesourcery.com/public/cxx-abi/abi-eh.html
15 // It also supports the closely-related ARM C++ ABI, documented at:
16 // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
18 //===----------------------------------------------------------------------===//
21 #include "clang/AST/ASTContext.h"
22 #include "clang/AST/Type.h"
24 using namespace clang;
27 class ItaniumCXXABI : public CXXABI {
31 ItaniumCXXABI(ASTContext &Ctx) : Context(Ctx) { }
33 unsigned getMemberPointerSize(const MemberPointerType *MPT) const {
34 QualType Pointee = MPT->getPointeeType();
35 if (Pointee->isFunctionType()) return 2;
40 class ARMCXXABI : public ItaniumCXXABI {
42 ARMCXXABI(ASTContext &Ctx) : ItaniumCXXABI(Ctx) { }
46 CXXABI *clang::CreateItaniumCXXABI(ASTContext &Ctx) {
47 return new ItaniumCXXABI(Ctx);
50 CXXABI *clang::CreateARMCXXABI(ASTContext &Ctx) {
51 return new ARMCXXABI(Ctx);