forked from OSchip/llvm-project
[MS] Put member pointer representation flags in our debug info
llvm-svn: 273063
This commit is contained in:
parent
0bb294b224
commit
fb72718ebf
|
@ -1172,6 +1172,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
|
|||
llvm::DIType *ContainingType = nullptr;
|
||||
unsigned Virtuality = 0;
|
||||
unsigned VIndex = 0;
|
||||
unsigned Flags = 0;
|
||||
|
||||
if (Method->isVirtual()) {
|
||||
if (Method->isPure())
|
||||
|
@ -1199,7 +1200,6 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
|
|||
ContainingType = RecordTy;
|
||||
}
|
||||
|
||||
unsigned Flags = 0;
|
||||
if (Method->isImplicit())
|
||||
Flags |= llvm::DINode::FlagArtificial;
|
||||
Flags |= getAccessFlag(Method->getAccess(), Method->getParent());
|
||||
|
@ -2049,12 +2049,35 @@ llvm::DIType *CGDebugInfo::CreateType(const RValueReferenceType *Ty,
|
|||
|
||||
llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
|
||||
llvm::DIFile *U) {
|
||||
uint64_t Size =
|
||||
!Ty->isIncompleteType() ? CGM.getContext().getTypeSize(Ty) : 0;
|
||||
unsigned Flags = 0;
|
||||
uint64_t Size = 0;
|
||||
|
||||
if (!Ty->isIncompleteType()) {
|
||||
Size = CGM.getContext().getTypeSize(Ty);
|
||||
|
||||
// Set the MS inheritance model. There is no flag for the unspecified model.
|
||||
if (CGM.getTarget().getCXXABI().isMicrosoft()) {
|
||||
switch (Ty->getMostRecentCXXRecordDecl()->getMSInheritanceModel()) {
|
||||
case MSInheritanceAttr::Keyword_single_inheritance:
|
||||
Flags |= llvm::DINode::FlagSingleInheritance;
|
||||
break;
|
||||
case MSInheritanceAttr::Keyword_multiple_inheritance:
|
||||
Flags |= llvm::DINode::FlagMultipleInheritance;
|
||||
break;
|
||||
case MSInheritanceAttr::Keyword_virtual_inheritance:
|
||||
Flags |= llvm::DINode::FlagVirtualInheritance;
|
||||
break;
|
||||
case MSInheritanceAttr::Keyword_unspecified_inheritance:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llvm::DIType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
|
||||
if (Ty->isMemberDataPointerType())
|
||||
return DBuilder.createMemberPointerType(
|
||||
getOrCreateType(Ty->getPointeeType(), U), ClassType, Size);
|
||||
getOrCreateType(Ty->getPointeeType(), U), ClassType, Size, /*Align=*/0,
|
||||
Flags);
|
||||
|
||||
const FunctionProtoType *FPT =
|
||||
Ty->getPointeeType()->getAs<FunctionProtoType>();
|
||||
|
@ -2062,7 +2085,7 @@ llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
|
|||
getOrCreateInstanceMethodType(CGM.getContext().getPointerType(QualType(
|
||||
Ty->getClass(), FPT->getTypeQuals())),
|
||||
FPT, U),
|
||||
ClassType, Size);
|
||||
ClassType, Size, /*Align=*/0, Flags);
|
||||
}
|
||||
|
||||
llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-windows -debug-info-kind=limited -gcodeview %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
// Test member pointer inheritance models.
|
||||
|
||||
struct A { int a; };
|
||||
struct B { int b; };
|
||||
struct C : A, B { int c; };
|
||||
struct D : virtual C { int d; };
|
||||
struct E;
|
||||
int A::*pmd_a;
|
||||
int C::*pmd_b;
|
||||
int D::*pmd_c;
|
||||
int E::*pmd_d;
|
||||
void (A::*pmf_a)();
|
||||
void (C::*pmf_b)();
|
||||
void (D::*pmf_c)();
|
||||
void (E::*pmf_d)();
|
||||
|
||||
// Test incomplete MPTs, which don't have inheritance models.
|
||||
|
||||
struct Incomplete;
|
||||
int Incomplete::**ppmd;
|
||||
void (Incomplete::**ppmf)();
|
||||
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmd_a", {{.*}} type: ![[pmd_a:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmd_a]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 32, flags: DIFlagSingleInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmd_b", {{.*}} type: ![[pmd_b:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmd_b]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 32, flags: DIFlagMultipleInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmd_c", {{.*}} type: ![[pmd_c:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmd_c]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 64, flags: DIFlagVirtualInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmd_d", {{.*}} type: ![[pmd_d:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmd_d]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 96,
|
||||
// CHECK-NOT: flags:
|
||||
// CHECK-SAME: ){{$}}
|
||||
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmf_a", {{.*}} type: ![[pmf_a:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmf_a]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 64, flags: DIFlagSingleInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmf_b", {{.*}} type: ![[pmf_b:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmf_b]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 128, flags: DIFlagMultipleInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmf_c", {{.*}} type: ![[pmf_c:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmf_c]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 128, flags: DIFlagVirtualInheritance, {{.*}})
|
||||
// CHECK: distinct !DIGlobalVariable(name: "pmf_d", {{.*}} type: ![[pmf_d:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[pmf_d]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 192,
|
||||
// CHECK-NOT: flags:
|
||||
// CHECK-SAME: ){{$}}
|
||||
|
||||
// CHECK: distinct !DIGlobalVariable(name: "ppmd", {{.*}} type: ![[ppmd:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[ppmd]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmd2:[^ ]*]], size: 64, align: 64)
|
||||
// CHECK: ![[ppmd2]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{[0-9]*}}, extraData: !{{[0-9]*}}){{$}}
|
||||
// CHECK: distinct !DIGlobalVariable(name: "ppmf", {{.*}} type: ![[ppmf:[^, ]*]], {{.*}})
|
||||
// CHECK: ![[ppmf]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmf2:[^ ]*]], size: 64, align: 64)
|
||||
// CHECK: ![[ppmf2]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{[0-9]*}}, extraData: !{{[0-9]*}}){{$}}
|
Loading…
Reference in New Issue