mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 07:09:08 +00:00
[CodeView] Emit HasConstructorOrDestructor class option for non-trivial constructors
Reviewers: zturner, rnk, llvm-commits, aleksandr.urakov Reviewed By: zturner, rnk Subscribers: jdoerfert, majnemer, asmith Tags: #llvm Differential Revision: https://reviews.llvm.org/D44406 llvm-svn: 354841
This commit is contained in:
parent
fa6c912a75
commit
af9405a1cb
@ -59,6 +59,7 @@ HANDLE_DI_FLAG((1 << 26), Trivial)
|
||||
HANDLE_DI_FLAG((1 << 27), BigEndian)
|
||||
HANDLE_DI_FLAG((1 << 28), LittleEndian)
|
||||
HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
|
||||
HANDLE_DI_FLAG((1 << 30), NonTrivial)
|
||||
|
||||
// To avoid needing a dedicated value for IndirectVirtualBase, we use
|
||||
// the bitwise or of Virtual and FwdDecl, which does not otherwise
|
||||
@ -68,7 +69,7 @@ HANDLE_DI_FLAG((1 << 2) | (1 << 5), IndirectVirtualBase)
|
||||
#ifdef DI_FLAG_LARGEST_NEEDED
|
||||
// intended to be used with ADT/BitmaskEnum.h
|
||||
// NOTE: always must be equal to largest flag, check this when adding new flag
|
||||
HANDLE_DI_FLAG((1 << 29), Largest)
|
||||
HANDLE_DI_FLAG((1 << 30), Largest)
|
||||
#undef DI_FLAG_LARGEST_NEEDED
|
||||
#endif
|
||||
|
||||
|
@ -363,8 +363,8 @@ TypeIndex CodeViewDebug::getFuncIdForSubprogram(const DISubprogram *SP) {
|
||||
return recordTypeIndexForDINode(SP, TI);
|
||||
}
|
||||
|
||||
static bool isTrivial(const DICompositeType *DCTy) {
|
||||
return ((DCTy->getFlags() & DINode::FlagTrivial) == DINode::FlagTrivial);
|
||||
static bool isNonTrivial(const DICompositeType *DCTy) {
|
||||
return ((DCTy->getFlags() & DINode::FlagNonTrivial) == DINode::FlagNonTrivial);
|
||||
}
|
||||
|
||||
static FunctionOptions
|
||||
@ -379,12 +379,12 @@ getFunctionOptions(const DISubroutineType *Ty,
|
||||
}
|
||||
|
||||
if (auto *ReturnDCTy = dyn_cast_or_null<DICompositeType>(ReturnTy)) {
|
||||
if (!isTrivial(ReturnDCTy))
|
||||
if (isNonTrivial(ReturnDCTy))
|
||||
FO |= FunctionOptions::CxxReturnUdt;
|
||||
}
|
||||
|
||||
// DISubroutineType is unnamed. Use DISubprogram's i.e. SPName in comparison.
|
||||
if (ClassTy && !isTrivial(ClassTy) && SPName == ClassTy->getName()) {
|
||||
if (ClassTy && isNonTrivial(ClassTy) && SPName == ClassTy->getName()) {
|
||||
FO |= FunctionOptions::Constructor;
|
||||
|
||||
// TODO: put the FunctionOptions::ConstructorWithVirtualBases flag.
|
||||
@ -2186,6 +2186,14 @@ TypeIndex CodeViewDebug::lowerCompleteTypeClass(const DICompositeType *Ty) {
|
||||
if (ContainsNestedClass)
|
||||
CO |= ClassOptions::ContainsNestedClass;
|
||||
|
||||
// MSVC appears to set this flag by searching any destructor or method with
|
||||
// FunctionOptions::Constructor among the emitted members. Clang AST has all
|
||||
// the members, however special member functions are not yet emitted into
|
||||
// debug information. For now checking a class's non-triviality seems enough.
|
||||
// FIXME: not true for a nested unnamed struct.
|
||||
if (isNonTrivial(Ty))
|
||||
CO |= ClassOptions::HasConstructorOrDestructor;
|
||||
|
||||
std::string FullName = getFullyQualifiedName(Ty);
|
||||
|
||||
uint64_t SizeInBytes = Ty->getSizeInBits() / 8;
|
||||
|
1012
test/DebugInfo/COFF/class-options-common.ll
Normal file
1012
test/DebugInfo/COFF/class-options-common.ll
Normal file
File diff suppressed because it is too large
Load Diff
@ -466,7 +466,7 @@ entry:
|
||||
ret void, !dbg !108
|
||||
}
|
||||
|
||||
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone speculatable }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
@ -492,7 +492,7 @@ attributes #1 = { nounwind readnone speculatable }
|
||||
!16 = distinct !DISubprogram(name: "Func_BClass", linkageName: "?Func_BClass@@YA?AVBClass@@AEAV1@@Z", scope: !9, file: !9, line: 12, type: !17, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!17 = !DISubroutineType(types: !18)
|
||||
!18 = !{!19, !25}
|
||||
!19 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "BClass", file: !9, line: 8, size: 8, flags: DIFlagTypePassByValue, elements: !20, identifier: ".?AVBClass@@")
|
||||
!19 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "BClass", file: !9, line: 8, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !20, identifier: ".?AVBClass@@")
|
||||
!20 = !{!21}
|
||||
!21 = !DISubprogram(name: "BClass", scope: !19, file: !9, line: 10, type: !22, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagExplicit | DIFlagPrototyped, isOptimized: false)
|
||||
!22 = !DISubroutineType(types: !23)
|
||||
@ -516,7 +516,7 @@ attributes #1 = { nounwind readnone speculatable }
|
||||
!40 = distinct !DISubprogram(name: "Func_C2Class", linkageName: "?Func_C2Class@@YA?AVC2Class@@AEAV1@@Z", scope: !9, file: !9, line: 24, type: !41, isLocal: false, isDefinition: true, scopeLine: 24, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!41 = !DISubroutineType(types: !42)
|
||||
!42 = !{!43, !49}
|
||||
!43 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C2Class", file: !9, line: 20, size: 8, flags: DIFlagTypePassByValue, elements: !44, identifier: ".?AVC2Class@@")
|
||||
!43 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C2Class", file: !9, line: 20, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !44, identifier: ".?AVC2Class@@")
|
||||
!44 = !{!45}
|
||||
!45 = !DISubprogram(name: "~C2Class", scope: !43, file: !9, line: 22, type: !46, isLocal: false, isDefinition: false, scopeLine: 22, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)
|
||||
!46 = !DISubroutineType(types: !47)
|
||||
@ -528,7 +528,7 @@ attributes #1 = { nounwind readnone speculatable }
|
||||
!52 = distinct !DISubprogram(name: "Func_DClass", linkageName: "?Func_DClass@@YA?AVDClass@@AEAV1@@Z", scope: !9, file: !9, line: 27, type: !53, isLocal: false, isDefinition: true, scopeLine: 27, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!53 = !DISubroutineType(types: !54)
|
||||
!54 = !{!55, !58}
|
||||
!55 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "DClass", file: !9, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !56, identifier: ".?AVDClass@@")
|
||||
!55 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "DClass", file: !9, line: 26, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !56, identifier: ".?AVDClass@@")
|
||||
!56 = !{!57}
|
||||
!57 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !55, baseType: !19, flags: DIFlagPublic, extraData: i32 0)
|
||||
!58 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !55, size: 64)
|
||||
@ -554,7 +554,7 @@ attributes #1 = { nounwind readnone speculatable }
|
||||
!78 = distinct !DISubprogram(name: "Func_BStruct", linkageName: "?Func_BStruct@@YA?AUBStruct@@AEAU1@@Z", scope: !9, file: !9, line: 36, type: !79, isLocal: false, isDefinition: true, scopeLine: 36, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!79 = !DISubroutineType(types: !80)
|
||||
!80 = !{!81, !87}
|
||||
!81 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BStruct", file: !9, line: 35, size: 8, flags: DIFlagTypePassByValue, elements: !82, identifier: ".?AUBStruct@@")
|
||||
!81 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BStruct", file: !9, line: 35, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !82, identifier: ".?AUBStruct@@")
|
||||
!82 = !{!83}
|
||||
!83 = !DISubprogram(name: "BStruct", scope: !81, file: !9, line: 35, type: !84, isLocal: false, isDefinition: false, scopeLine: 35, flags: DIFlagPrototyped, isOptimized: false)
|
||||
!84 = !DISubroutineType(types: !85)
|
||||
|
@ -197,7 +197,7 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma
|
||||
; YAML: ClassType: 4100
|
||||
; YAML: ThisType: 4101
|
||||
; YAML: CallConv: ThisCall
|
||||
; YAML: Options: [ None, Constructor ]
|
||||
; YAML: Options: [ None ]
|
||||
; YAML: ParameterCount: 2
|
||||
; YAML: ArgumentList: 4102
|
||||
; YAML: ThisPointerAdjustment: 0
|
||||
@ -283,14 +283,14 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma
|
||||
; YAML: - C324F82D24D22283
|
||||
; YAML: - BB039258F2425BCF
|
||||
; YAML: - DDE23757322DB7C3
|
||||
; YAML: - C935E8E1F016CC27
|
||||
; YAML: - 44D3ED149C981B2A
|
||||
; YAML: - D341E2F9BE57A1C7
|
||||
; YAML: - DD327744BE6783A4
|
||||
; YAML: - 479521BB013A4AEC
|
||||
; YAML: - 7820AAA31FC8CC67
|
||||
; YAML: - 5B17837C70325869
|
||||
; YAML: - 375C55CDF44B4147
|
||||
; YAML: - 0634944401BCC520
|
||||
; YAML: - F380373F5DE8E9A3
|
||||
; YAML: - 2ADB463E9E726E20
|
||||
; YAML: - 6CC0AFB95FA2BFF2
|
||||
; YAML: - D016F92E5C009314
|
||||
; YAML: - 74698BE366891D3D
|
||||
; YAML: - 4470750F2E319329
|
||||
; YAML: - 0FB556FD1FAB66D7
|
||||
|
Loading…
Reference in New Issue
Block a user