Index: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1766,6 +1766,16 @@ } } + for (const DINode *Element : Ty->getElements()) { + if (auto *Method = dyn_cast_or_null(Element)) { + StringRef Name = Method->getName(); + if (Name == Ty->getName() || (!Name.empty() && Name[0] == '~')) { + CO |= ClassOptions::HasConstructorOrDestructor; + break; + } + } + } + return CO; } Index: test/DebugInfo/COFF/global-type-hashes.ll =================================================================== --- test/DebugInfo/COFF/global-type-hashes.ll +++ test/DebugInfo/COFF/global-type-hashes.ll @@ -176,7 +176,7 @@ ; YAML: - Kind: LF_STRUCTURE ; YAML: Class: ; YAML: MemberCount: 0 -; YAML: Options: [ None, ForwardReference, HasUniqueName ] +; YAML: Options: [ None, HasConstructorOrDestructor, ForwardReference, HasUniqueName ] ; YAML: FieldList: 0 ; YAML: Name: Foo ; YAML: UniqueName: '.?AUFoo@@' @@ -242,7 +242,7 @@ ; YAML: - Kind: LF_STRUCTURE ; YAML: Class: ; YAML: MemberCount: 4 -; YAML: Options: [ None, HasUniqueName ] +; YAML: Options: [ None, HasConstructorOrDestructor, HasUniqueName ] ; YAML: FieldList: 4106 ; YAML: Name: Foo ; YAML: UniqueName: '.?AUFoo@@' @@ -279,18 +279,18 @@ ; YAML: - FDEC3D2D96287486127C66070B248ED52E421F55 ; YAML: - 074AE5CC2D68AF9F0A3BEF23993968F7FD82CA84 ; YAML: - BF0439C1A64C9070C6A6ADB0A34D21DAD0FFC3E9 -; YAML: - CF1B3AD4A96BA628E6556FD28A222FBBEBBE140E -; YAML: - EC50195BFE148C0DC6A87A59D49CA1D9B146DB86 +; YAML: - 4A744E1B2BF83A984291E364C6FB32293878C49A +; YAML: - D860A94A3D72CC44881DEF185446DDCAE21D9BE9 ; YAML: - 123C8BA63AD23386897AB6D814A9932F03846156 -; YAML: - 0F135243878289B83835BC2DB9EE25A1D4D0DA2B +; YAML: - DE52A1DA2221AEC85AA5E5DB6F32C3F2666BFAF4 ; YAML: - 9069CA78E7450A285173431B3E52C5C25299E473 -; YAML: - ADA6E11350E9F2069D4689E3646C90D67B28DA62 -; YAML: - BD535FA9877A4DD123840AF849F3B0110EEB1D7A -; YAML: - 8044F70193FE40B71867158C5E50F0467485FA99 +; YAML: - 52D7AC18F997BE7EB4EE3A3A423DB52834167B20 +; YAML: - CAB1D3F0DD776BBF7BCA87B0C5882A25FECFD7F8 +; YAML: - ED35066CBA0688C879B81071219ECC3B65DC5143 ; YAML: - 558606D57A76D125B705FC6DD18EEE3C1C0C4C09 -; YAML: - A64A018D9EB1EB8015917925662C8508D81CDA68 -; YAML: - 51E89AD9992AC6F11F9E3F1665F41C53BDA8AFC4 -; YAML: - 4F1C3BCA73099EF3466AAC99CC4951767DF890F5 +; YAML: - D06C349364B6AE1D1C187094EFF46216B6B80F79 +; YAML: - 7E21BE8AE67D602071022B3051B489D4107486DD +; YAML: - 8E7F093B5E5907268294A62AE09639AD762B9333 ; ...