summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-01-07 17:49:30 +0000
committerAdrian Prantl <aprantl@apple.com>2015-01-07 17:49:30 +0000
commit0772dbd12566c6ed2be3a4407b1472808c9fc5c9 (patch)
tree2453114bb584f0f7369e1b90979791b23442640f
parentbb763e6b47ce0ff37a439909fd5baa62c0b8c39d (diff)
downloadbcm5719-llvm-0772dbd12566c6ed2be3a4407b1472808c9fc5c9.tar.gz
bcm5719-llvm-0772dbd12566c6ed2be3a4407b1472808c9fc5c9.zip
Debug info: pass in the correct size for a pointer to a member function.
This corrects a bug I introduced in r224781. llvm-svn: 225359
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp4
-rw-r--r--clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp10
2 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 6a911c5e69c..978e1bb5b81 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1883,7 +1883,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty,
if (!Ty->getPointeeType()->isFunctionType())
return DBuilder.createMemberPointerType(
getOrCreateType(Ty->getPointeeType(), U), ClassType,
- CGM.PointerWidthInBits);
+ CGM.getContext().getTypeSize(Ty));
const FunctionProtoType *FPT =
Ty->getPointeeType()->getAs<FunctionProtoType>();
@@ -1891,7 +1891,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty,
getOrCreateInstanceMethodType(CGM.getContext().getPointerType(QualType(
Ty->getClass(), FPT->getTypeQuals())),
FPT, U),
- ClassType, CGM.PointerWidthInBits);
+ ClassType, CGM.getContext().getTypeSize(Ty));
}
llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile U) {
diff --git a/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp b/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp
new file mode 100644
index 00000000000..656e6f49588
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s
+
+struct T {
+ int method();
+};
+
+void foo(int (T::*method)()) {}
+
+// A pointer to a member function is a pair of function- and this-pointer.
+// CHECK: [ DW_TAG_ptr_to_member_type ] {{.*}} size 128
OpenPOWER on IntegriCloud