Skip to content

Commit

Permalink
Add DWARF address space to DIDerivedType (added in LLVM 5)
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett and RyanGlScott committed Apr 5, 2023
1 parent b13493f commit cd9a513
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/Text/LLVM/AST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,17 +1276,22 @@ data DICompositeType' lab = DICompositeType
type DICompositeType = DICompositeType' BlockLabel

data DIDerivedType' lab = DIDerivedType
{ didtTag :: DwarfTag
, didtName :: Maybe String
, didtFile :: Maybe (ValMd' lab)
, didtLine :: Word32
, didtScope :: Maybe (ValMd' lab)
, didtBaseType :: Maybe (ValMd' lab)
, didtSize :: Word64
, didtAlign :: Word64
, didtOffset :: Word64
, didtFlags :: DIFlags
, didtExtraData :: Maybe (ValMd' lab)
{ didtTag :: DwarfTag
, didtName :: Maybe String
, didtFile :: Maybe (ValMd' lab)
, didtLine :: Word32
, didtScope :: Maybe (ValMd' lab)
, didtBaseType :: Maybe (ValMd' lab)
, didtSize :: Word64
, didtAlign :: Word64
, didtOffset :: Word64
, didtFlags :: DIFlags
, didtExtraData :: Maybe (ValMd' lab)
, didtDwarfAddressSpace :: Maybe Word32
-- ^ Introduced in LLVM 5.
--
-- The 'Maybe' encodes the possibility that there is no associated address
-- space (in LLVM, the sentinel value @0@ is used for this).
} deriving (Data, Eq, Functor, Generic, Generic1, Ord, Show, Typeable)

type DIDerivedType = DIDerivedType' BlockLabel
Expand Down
1 change: 1 addition & 0 deletions src/Text/LLVM/PP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ ppDIDerivedType' pp dt = "!DIDerivedType"
, pure ("offset:" <+> integral (didtOffset dt))
, pure ("flags:" <+> integral (didtFlags dt))
, (("extraData:" <+>) . ppValMd' pp) <$> (didtExtraData dt)
, (("dwarfAddressSpace:" <+>) . integral) <$> didtDwarfAddressSpace dt
])

ppDIDerivedType :: LLVM => DIDerivedType -> Doc
Expand Down

0 comments on commit cd9a513

Please sign in to comment.