MS ABI: Don't ICE for pointers to pointers to members of incomplete classes

CodeGen would try to come up with an LLVM IR type for a pointer to
member type on the way to forming an LLVM IR type for a pointer to
pointer to member type.

However, if the pointer to member representation has not been locked in yet,
we would not be able to come up with a pointer to member IR type.

In these cases, make the pointer to member type an incomplete type.
This will make the pointer to pointer to member type a pointer to an
incomplete type.  If the class eventually obtains an inheritance model,
we will make the pointer to member type represent the actual inheritance
model.

Differential Revision: http://reviews.llvm.org/D5373

llvm-svn: 218084
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 36392bc..dd6a458 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -488,7 +488,18 @@
 
   bool isMemberPointerConvertible(const MemberPointerType *MPT) const override {
     const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
-    return RD->getAttr<MSInheritanceAttr>() != nullptr;
+    return RD->hasAttr<MSInheritanceAttr>();
+  }
+
+  virtual bool isTypeInfoCalculable(QualType Ty) const {
+    if (!CGCXXABI::isTypeInfoCalculable(Ty))
+      return false;
+    if (const auto *MPT = Ty->getAs<MemberPointerType>()) {
+      const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
+      if (!RD->hasAttr<MSInheritanceAttr>())
+        return false;
+    }
+    return true;
   }
 
   llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT) override;