summaryrefslogtreecommitdiffstats
path: root/clang/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
commit18f7c59946465a4c515aa86159920cc19cab7463 (patch)
tree0cea5fc1f2eae20371b798edadb09e3010e7fb95 /clang/lib/CodeGen/CGDebugInfo.cpp
parent5d3249b55444973dc21d3beaec6ffa2198ac65d2 (diff)
downloadbcm5719-llvm-18f7c59946465a4c515aa86159920cc19cab7463.tar.gz
bcm5719-llvm-18f7c59946465a4c515aa86159920cc19cab7463.zip
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. llvm-svn: 171699
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index bc715f4d6d2..4ebce65ff42 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud