diff --git a/disasm-test/tests/diderivedtype-address-space.at-least-llvm14.ll b/disasm-test/tests/diderivedtype-address-space.at-least-llvm14.ll new file mode 100644 index 00000000..b649c798 --- /dev/null +++ b/disasm-test/tests/diderivedtype-address-space.at-least-llvm14.ll @@ -0,0 +1,4 @@ +;; Adapted from https://github.com/llvm/llvm-project/blob/d5561e0a0bbd484da17d3b68ae5fedc0a057246b/llvm/test/Assembler/debug-info.ll + +!7 = !DIBasicType(tag: DW_TAG_base_type, name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char) +!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, align: 32, dwarfAddressSpace: 1) diff --git a/llvm-pretty b/llvm-pretty index b13493fd..cd9a513f 160000 --- a/llvm-pretty +++ b/llvm-pretty @@ -1 +1 @@ -Subproject commit b13493fda7276835a4e19bf13a9fb1b3e08083a9 +Subproject commit cd9a513fcf33312824cdc0ecd6e3ca7172bc592f diff --git a/src/Data/LLVM/BitCode/IR/Metadata.hs b/src/Data/LLVM/BitCode/IR/Metadata.hs index 12f2d953..e42f6a7c 100644 --- a/src/Data/LLVM/BitCode/IR/Metadata.hs +++ b/src/Data/LLVM/BitCode/IR/Metadata.hs @@ -607,6 +607,9 @@ parseMetadataEntry vt mt pm (fromEntry -> Just r) = <*> parseField r 9 numeric -- didtOffset <*> parseField r 10 numeric -- didtFlags <*> (mdForwardRefOrNull ctx mt <$> parseField r 11 numeric) -- didtExtraData + <*> (if length (recordFields r) <= 12 + then pure Nothing + else Just <$> parseField r 12 numeric) -- didtDwarfAddressSpace return $! updateMetadataTable (addDebugInfo isDistinct (DebugInfoDerivedType didt)) pm