aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-01-07 05:55:03 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-01-07 05:55:03 +0000
commit0028ee3dd32c5e3b089c0ef176b97ebcdd2c4cf6 (patch)
tree27c280f3970f23f2fad2332a0876f9b0454b8f85 /lib/CodeGen/CGDebugInfo.cpp
parentd938e87458f18ffe4314936c5ab985b6b232c31f (diff)
PR14759: Improve/correct support for debug info for C++ member pointers.
Using added LLVM functionality in r171698. This works in GDB for member variable pointers but not member function pointers. See the LLVM commit and GDB bug 14998 for details. Un-xfailing cases in the GDB 7.5 test suite will follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index bc715f4d6d..4ebce65ff4 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1589,38 +1589,8 @@ llvm::DIType CGDebugInfo::CreateType(const RValueReferenceType *Ty,
llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty,
llvm::DIFile U) {
- QualType PointerDiffTy = CGM.getContext().getPointerDiffType();
- llvm::DIType PointerDiffDITy = getOrCreateType(PointerDiffTy, U);
-
- if (!Ty->getPointeeType()->isFunctionType()) {
- // We have a data member pointer type.
- return PointerDiffDITy;
- }
-
- // We have a member function pointer type. Treat it as a struct with two
- // ptrdiff_t members.
- std::pair<uint64_t, unsigned> Info = CGM.getContext().getTypeInfo(Ty);
-
- uint64_t FieldOffset = 0;
- llvm::Value *ElementTypes[2];
-
- // FIXME: This should be a DW_TAG_pointer_to_member type.
- ElementTypes[0] =
- DBuilder.createMemberType(U, "ptr", U, 0,
- Info.first, Info.second, FieldOffset, 0,
- PointerDiffDITy);
- FieldOffset += Info.first;
-
- ElementTypes[1] =
- DBuilder.createMemberType(U, "ptr", U, 0,
- Info.first, Info.second, FieldOffset, 0,
- PointerDiffDITy);
-
- llvm::DIArray Elements = DBuilder.getOrCreateArray(ElementTypes);
-
- return DBuilder.createStructType(U, StringRef("test"),
- U, 0, FieldOffset,
- 0, 0, Elements);
+ return DBuilder.createMemberPointerType(CreatePointeeType(Ty->getPointeeType(), U),
+ getOrCreateType(QualType(Ty->getClass(), 0), U));
}
llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty,