diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-05-17 02:06:04 +0000 | 
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-05-17 02:06:04 +0000 | 
| commit | 32440a0f488fb1d8fb5ad468adc66a8ffc2afbe2 (patch) | |
| tree | 2022a414b6aacbbd2f5e0dfc1f7f6b3f88b74b7e /clang/lib | |
| parent | 8f1d33e21890f9afd5dce7435952ba147e25a2fd (diff) | |
| download | bcm5719-llvm-32440a0f488fb1d8fb5ad468adc66a8ffc2afbe2.tar.gz bcm5719-llvm-32440a0f488fb1d8fb5ad468adc66a8ffc2afbe2.zip  | |
Use the Itanium ABI for member pointers. Add a missing 'break' statement and a test case
llvm-svn: 71972
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 18 | 
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ccd3762da05..329d6c478d5 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -475,18 +475,18 @@ ASTContext::getTypeInfo(const Type *T) {      // pointer size.      return getTypeInfo(cast<ReferenceType>(T)->getPointeeType());    case Type::MemberPointer: { -    // FIXME: This is not only platform- but also ABI-dependent. We follow -    // the GCC ABI, where pointers to data are one pointer large, pointers to -    // functions two pointers. But if we want to support ABI compatibility with -    // other compilers too, we need to delegate this completely to TargetInfo -    // or some ABI abstraction layer. +    // FIXME: This is ABI dependent. We use the Itanium C++ ABI. +    // http://www.codesourcery.com/public/cxx-abi/abi.html#member-pointers +    // If we ever want to support other ABIs this needs to be abstracted. +      QualType Pointee = cast<MemberPointerType>(T)->getPointeeType(); -    unsigned AS = Pointee.getAddressSpace(); -    Width = Target.getPointerWidth(AS); +    std::pair<uint64_t, unsigned> PtrDiffInfo =  +      getTypeInfo(getPointerDiffType()); +    Width = PtrDiffInfo.first;      if (Pointee->isFunctionType())        Width *= 2; -    Align = Target.getPointerAlign(AS); -    // GCC aligns at single pointer width. +    Align = PtrDiffInfo.second; +    break;    }    case Type::Complex: {      // Complex types have the same alignment as their elements, but twice the  | 

