Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 1 | //===------- ItaniumCXXABI.cpp - AST support for the Itanium C++ ABI ------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This provides C++ AST support targetting the Itanium C++ ABI, which is |
| 11 | // documented at: |
| 12 | // http://www.codesourcery.com/public/cxx-abi/abi.html |
| 13 | // http://www.codesourcery.com/public/cxx-abi/abi-eh.html |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #include "CXXABI.h" |
| 17 | #include "clang/AST/ASTContext.h" |
| 18 | #include "clang/AST/Type.h" |
| 19 | |
| 20 | using namespace clang; |
| 21 | |
| 22 | namespace { |
| 23 | class ItaniumCXXABI : public CXXABI { |
| 24 | ASTContext &Context; |
| 25 | public: |
| 26 | ItaniumCXXABI(ASTContext &Ctx) : Context(Ctx) { } |
| 27 | |
| 28 | unsigned getMemberPointerSize(const MemberPointerType *MPT) const { |
| 29 | QualType Pointee = MPT->getPointeeType(); |
| 30 | if (Pointee->isFunctionType()) return 2; |
| 31 | return 1; |
| 32 | } |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | CXXABI *clang::CreateItaniumCXXABI(ASTContext &Ctx) { |
| 37 | return new ItaniumCXXABI(Ctx); |
| 38 | } |
| 39 | |