diff options
author | John McCall <rjmccall@apple.com> | 2010-08-22 21:01:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-22 21:01:12 +0000 |
commit | f16aa103d3afd42fbca2ab346f191bf745cec092 (patch) | |
tree | af2fd36fb705f0d900afe40561c89341546459b6 /lib/CodeGen/ItaniumCXXABI.cpp | |
parent | b76495673a381d209410d78af9d969bb3ae0a95a (diff) |
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
Diffstat (limited to 'lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | lib/CodeGen/ItaniumCXXABI.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 4aa433c7ca..37244398f3 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -41,8 +41,7 @@ public: 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 @@ ItaniumCXXABI::EmitMemberFunctionPointerIsNotNull(CodeGenFunction &CGF, 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(); } |