diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-02 15:00:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-02 15:00:29 +0000 |
commit | b61e2a328c5c2552b0bb3a8d3c4bc9389f34a321 (patch) | |
tree | e22ec7a8f6d33e962da0ba5e3fc07db95b8209fc /lib/CodeGen/ItaniumCXXABI.cpp | |
parent | 9cb2cee212d708220c52249ceac4cdd9f2b8aeb0 (diff) |
Fix a crash involving pointer-to-data-members of boolean type. We were
constructing an LLVM PointerType directly from the "bool"'s LLVM type
(i1), which resulted in unfortunate pointer type i1*. The fix is to
build the LLVM PointerType from the corresponding Clang PointerType,
so that we get i8* in the case of a bool.
John, please review. I also left a FIXME there because we seem to be
dropping "volatile", which would be rather unfortunate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | lib/CodeGen/ItaniumCXXABI.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index a1a53ad5e0..85b52c6322 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -305,8 +305,13 @@ llvm::Value *ItaniumCXXABI::EmitMemberDataPointerAddress(CodeGenFunction &CGF, // Cast the address to the appropriate pointer type, adopting the // address space of the base pointer. - const llvm::Type *PType - = CGF.ConvertType(MPT->getPointeeType())->getPointerTo(AS); + // FIXME: We seem to be losing the "volatile" qualifier on the base pointer. + QualType PtrType = CGF.getContext().getPointerType(MPT->getPointeeType()); + Qualifiers Qs = MPT->getPointeeType().getQualifiers(); + if (AS) + Qs.addAddressSpace(AS); + PtrType = CGF.getContext().getQualifiedType(PtrType, Qs); + const llvm::Type *PType = CGF.ConvertType(PtrType); return Builder.CreateBitCast(Addr, PType); } |