This patch gives member pointers the correct size when the Microsoft ABI
is active. This only implements the Sema/AST side (CodeGen coming soon).
Chip
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp (revision 111084)
+++ lib/AST/ASTContext.cpp (working copy)
@@ -718,7 +718,18 @@
std::pair<uint64_t, unsigned> PtrDiffInfo =
getTypeInfo(getPointerDiffType());
Width = PtrDiffInfo.first;
- if (Pointee->isFunctionType())
+ if (Target.getCXXABI() == "microsoft") {
+ Type *ClassType = cast<MemberPointerType>(T)->getClass();
+ CXXRecordDecl *RD = ClassType->getAsCXXRecordDecl();
+ if (RD->getNumVBases() > 0) {
+ if (Pointee->isFunctionType())
+ Width *= 3;
+ else
+ Width *= 2;
+ } else if (RD->getNumBases > 1 && Pointee->isFunctionType()) {
+ Width *= 2;
+ }
+ } else if (Pointee->isFunctionType())
Width *= 2;
Align = PtrDiffInfo.second;
break;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits