diff options
author | Charles Davis <cdavis@mines.edu> | 2010-08-16 03:33:14 +0000 |
---|---|---|
committer | Charles Davis <cdavis@mines.edu> | 2010-08-16 03:33:14 +0000 |
commit | 071cc7deffad608165b1ddd5263e8bf181861520 (patch) | |
tree | 6d68d7edf284b5e28784142748d07350ba20d9a3 /lib/AST/ASTContext.cpp | |
parent | e701117b21356d3c60133315b5bdd50232ec6cca (diff) |
Implement support for member pointers under the Microsoft C++ ABI in the
AST library.
This also adds infrastructure for supporting multiple C++ ABIs in the AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index adb75f0f61..1e437fdabe 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -28,6 +28,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" +#include "CXXABI.h" using namespace clang; @@ -134,6 +135,14 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( return CanonTTP; } +CXXABI *ASTContext::createCXXABI(const TargetInfo &T) { + if (!LangOpts.CPlusPlus) return NULL; + if (T.getCXXABI() == "microsoft") + return CreateMicrosoftCXXABI(*this); + else + return CreateItaniumCXXABI(*this); +} + ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM, const TargetInfo &t, IdentifierTable &idents, SelectorTable &sels, @@ -146,7 +155,7 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM, ObjCFastEnumerationStateTypeDecl(0), FILEDecl(0), jmp_bufDecl(0), sigjmp_bufDecl(0), BlockDescriptorType(0), BlockDescriptorExtendedType(0), NullTypeSourceInfo(QualType()), - SourceMgr(SM), LangOpts(LOpts), Target(t), + SourceMgr(SM), LangOpts(LOpts), ABI(createCXXABI(t)), Target(t), Idents(idents), Selectors(sels), BuiltinInfo(builtins), DeclarationNames(*this), @@ -700,12 +709,10 @@ ASTContext::getTypeInfo(const Type *T) { break; } case Type::MemberPointer: { - QualType Pointee = cast<MemberPointerType>(T)->getPointeeType(); + const MemberPointerType *MPT = cast<MemberPointerType>(T); std::pair<uint64_t, unsigned> PtrDiffInfo = getTypeInfo(getPointerDiffType()); - Width = PtrDiffInfo.first; - if (Pointee->isFunctionType()) - Width *= 2; + Width = PtrDiffInfo.first * ABI->getMemberPointerSize(MPT); Align = PtrDiffInfo.second; break; } @@ -5640,3 +5647,5 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return true; } + +CXXABI::~CXXABI() {} |