Skip to content

Commit b98da9b

Browse files
committed
🍒 [llvm][MetadataLoader] Make sure we correctly load DW_APPLE_ENUM_KIND from bitcode
This was pointed out in llvm#124752 (comment) There was no test that roundtrips this attribute through LLVM bitcode, so this was never caught.
1 parent 4881efd commit b98da9b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,8 +1689,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
16891689
}
16901690
}
16911691

1692-
if (Record.size() > 25 && Record[25] != dwarf::DW_APPLE_ENUM_KIND_invalid)
1693-
EnumKind = Record[25];
1692+
if (Record.size() > 24 && Record[24] != dwarf::DW_APPLE_ENUM_KIND_invalid)
1693+
EnumKind = Record[24];
16941694

16951695
DICompositeType *CT = nullptr;
16961696
if (Identifier)

llvm/test/DebugInfo/AArch64/DW_AT_APPLE_enum_kind.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: llc < %s -filetype=obj -o %t
22
; RUN: llvm-dwarfdump -v %t | FileCheck %s
3+
;
4+
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s --check-prefix=CHECK-METADATA
35

46
; C++ source to regenerate:
57
; enum __attribute__((enum_extensibility(open))) OpenEnum {
@@ -12,6 +14,8 @@
1214
;
1315
; $ clang++ -O0 -g debug-info-enum-kind.cpp -c
1416

17+
; CHECK-METADATA: enumKind: DW_APPLE_ENUM_KIND_Open
18+
; CHECK-METADATA: enumKind: DW_APPLE_ENUM_KIND_Closed
1519

1620
; CHECK: .debug_abbrev contents:
1721

0 commit comments

Comments
 (0)