forked from OSchip/llvm-project
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
//===------- ItaniumCXXABI.cpp - AST support for the Itanium C++ ABI ------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This provides C++ AST support targetting the Itanium C++ ABI, which is
|
|
// documented at:
|
|
// http://www.codesourcery.com/public/cxx-abi/abi.html
|
|
// http://www.codesourcery.com/public/cxx-abi/abi-eh.html
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "CXXABI.h"
|
|
#include "clang/AST/ASTContext.h"
|
|
#include "clang/AST/Type.h"
|
|
|
|
using namespace clang;
|
|
|
|
namespace {
|
|
class ItaniumCXXABI : public CXXABI {
|
|
ASTContext &Context;
|
|
public:
|
|
ItaniumCXXABI(ASTContext &Ctx) : Context(Ctx) { }
|
|
|
|
unsigned getMemberPointerSize(const MemberPointerType *MPT) const {
|
|
QualType Pointee = MPT->getPointeeType();
|
|
if (Pointee->isFunctionType()) return 2;
|
|
return 1;
|
|
}
|
|
};
|
|
}
|
|
|
|
CXXABI *clang::CreateItaniumCXXABI(ASTContext &Ctx) {
|
|
return new ItaniumCXXABI(Ctx);
|
|
}
|
|
|