Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit bb0b26a

Browse files
author
Tom Tromey
committed
Ensure that variant part discriminator is read by MetadataLoader
Summary: https://reviews.llvm.org/D42082 introduced variant parts to debug info in LLVM. Subsequent work on the Rust compiler has found a bug in that patch; namely, there is a path in MetadataLoader that fails to restore the discriminator. This patch fixes the bug. This was accepted by upstream LLVM here: https://reviews.llvm.org/D52340
1 parent caddcd9 commit bb0b26a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
13111311
(Context, Tag, Name, File, Line, Scope, BaseType,
13121312
SizeInBits, AlignInBits, OffsetInBits, Flags,
13131313
Elements, RuntimeLang, VTableHolder, TemplateParams,
1314-
Identifier));
1314+
Identifier, Discriminator));
13151315
if (!IsNotUsedInTypeRef && Identifier)
13161316
MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT));
13171317

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
2+
; RUN: verify-uselistorder %s
3+
4+
; CHECK: !named = !{!0, !1, !2}
5+
!named = !{!0, !1, !2}
6+
7+
; CHECK: !0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer")
8+
; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2)
9+
; CHECK-NEXT: !2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial)
10+
; CHECK-NEXT: !3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
11+
!0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer")
12+
!1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2)
13+
!2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial)
14+
!3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)

0 commit comments

Comments
 (0)