Skip to content

Commit bf49ba3

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

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,8 +1704,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
17041704
}
17051705
}
17061706

1707-
if (Record.size() > 25 && Record[25] != dwarf::DW_APPLE_ENUM_KIND_invalid)
1708-
EnumKind = Record[25];
1707+
if (Record.size() > 24 && Record[24] != dwarf::DW_APPLE_ENUM_KIND_invalid)
1708+
EnumKind = Record[24];
17091709

17101710
DICompositeType *CT = nullptr;
17111711
if (Identifier)

llvm/test/DebugInfo/AArch64/DW_AT_APPLE_enum_kind.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
; RUN: llc < %s -filetype=obj -o %t
2-
; RUN: llvm-dwarfdump -v %t | FileCheck %s
1+
; RUN: clang++ %s -c -g -emit-llvm -o %t.bc
2+
; RUN: llc %t.bc -filetype=obj -o %t.o
3+
; RUN: llvm-dwarfdump -v %t.o | FileCheck %s
34

45
; C++ source to regenerate:
56
; enum __attribute__((enum_extensibility(open))) OpenEnum {

0 commit comments

Comments
 (0)