Go back to asking CodeGenTypes whether a type is zero-initializable.
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111786 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp
index 4aa433c..3724439 100644
--- a/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/lib/CodeGen/ItaniumCXXABI.cpp
@@ -41,8 +41,7 @@
     return MangleCtx;
   }
 
-  bool RequiresNonZeroInitializer(QualType T);
-  bool RequiresNonZeroInitializer(const CXXRecordDecl *D);
+  bool isZeroInitializable(const MemberPointerType *MPT);
 
   llvm::Value *EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
                                                llvm::Value *&This,
@@ -460,10 +459,8 @@
   return Result;
 }
 
-bool ItaniumCXXABI::RequiresNonZeroInitializer(QualType T) {
-  return CGM.getTypes().ContainsPointerToDataMember(T);
-}
-
-bool ItaniumCXXABI::RequiresNonZeroInitializer(const CXXRecordDecl *D) {
-  return CGM.getTypes().ContainsPointerToDataMember(D);
+/// The Itanium ABI requires non-zero initialization only for data
+/// member pointers, for which '0' is a valid offset.
+bool ItaniumCXXABI::isZeroInitializable(const MemberPointerType *MPT) {
+  return MPT->getPointeeType()->isFunctionType();
 }