r238259 - [MS ABI, DebugInfo] Omit the size for model-less pointers-to-members
David Majnemer
david.majnemer at gmail.com
Tue May 26 14:54:24 PDT 2015
Author: majnemer
Date: Tue May 26 16:54:24 2015
New Revision: 238259
URL: http://llvm.org/viewvc/llvm-project?rev=238259&view=rev
Log:
[MS ABI, DebugInfo] Omit the size for model-less pointers-to-members
The representation of a pointer-to-member in the MS ABI is governed by
the layout of the relevant class or if a model has been explicitly
specified. If no model is specified, then an appropriate
"worst-case-scenario" model is implicitly chosen if, and only, if the
pointer-to-member type's representation was needed.
Debug info cannot force a pointer-to-member type to have a
representation so do not try to query the size of such a type unless we
know it is safe to do so.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=238259&r1=238258&r2=238259&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue May 26 16:54:24 2015
@@ -1878,11 +1878,13 @@ llvm::DIType *CGDebugInfo::CreateType(co
llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
llvm::DIFile *U) {
+ uint64_t Size = CGM.getCXXABI().isTypeInfoCalculable(QualType(Ty, 0))
+ ? CGM.getContext().getTypeSize(Ty)
+ : 0;
llvm::DIType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
if (Ty->isMemberDataPointerType())
return DBuilder.createMemberPointerType(
- getOrCreateType(Ty->getPointeeType(), U), ClassType,
- CGM.getContext().getTypeSize(Ty));
+ getOrCreateType(Ty->getPointeeType(), U), ClassType, Size);
const FunctionProtoType *FPT =
Ty->getPointeeType()->getAs<FunctionProtoType>();
@@ -1890,7 +1892,7 @@ llvm::DIType *CGDebugInfo::CreateType(co
getOrCreateInstanceMethodType(CGM.getContext().getPointerType(QualType(
Ty->getClass(), FPT->getTypeQuals())),
FPT, U),
- ClassType, CGM.getContext().getTypeSize(Ty));
+ ClassType, Size);
}
llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
Modified: 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=238259&r1=238258&r2=238259&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ptr-to-member-function.cpp Tue May 26 16:54:24 2015
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -g -emit-llvm -o - | FileCheck -check-prefix=CHECK -check-prefix=DARWIN-X64 %s
+// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -g -emit-llvm -o - | FileCheck -check-prefix=CHECK -check-prefix=WIN32-X64 %s
struct T {
int method();
@@ -8,4 +9,13 @@ void foo(int (T::*method)()) {}
// A pointer to a member function is a pair of function- and this-pointer.
// CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type,
-// CHECK-SAME: size: 128
+// DARWIN-X64-SAME: size: 128
+// WIN32-X64-SAME: size: 64
+
+struct Incomplete;
+
+int (Incomplete::**bar)();
+// CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type,
+// DARWIN-X64-SAME: size: 128
+// WIN32-X64-NOT: size:
+// CHECK-SAME: extraData: {{.*}})
More information about the cfe-commits
mailing list