forked from OSchip/llvm-project
[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. llvm-svn: 238259
This commit is contained in:
parent
f3c1c065aa
commit
34568bc602
|
@ -1878,11 +1878,13 @@ llvm::DIType *CGDebugInfo::CreateType(const RValueReferenceType *Ty,
|
|||
|
||||
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(const MemberPointerType *Ty,
|
|||
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) {
|
||||
|
|
|
@ -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: {{.*}})
|
||||
|
|
Loading…
Reference in New Issue