r225359 - Debug info: pass in the correct size for a pointer to a member function.

Adrian Prantl aprantl at apple.com
Wed Jan 7 09:49:30 PST 2015


Author: adrian
Date: Wed Jan  7 11:49:30 2015
New Revision: 225359

URL: http://llvm.org/viewvc/llvm-project?rev=225359&view=rev
Log:
Debug info: pass in the correct size for a pointer to a member function.
This corrects a bug I introduced in r224781.

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=225359&r1=225358&r2=225359&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jan  7 11:49:30 2015
@@ -1883,7 +1883,7 @@ llvm::DIType CGDebugInfo::CreateType(con
   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(con
       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) {

Added: cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp?rev=225359&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp Wed Jan  7 11:49:30 2015
@@ -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





More information about the cfe-commits mailing list