Skip to content

Commit

Permalink
Merge pull request #150 from GaloisInc/dgb_1733634870-0
Browse files Browse the repository at this point in the history
More parameterization for functions not needing a specialized type parameter.
  • Loading branch information
kquick authored Dec 9, 2024
2 parents 9353217 + 439eda9 commit ea0ad98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Revision history for llvm-pretty

## pending

* Changed some of the signatures of helper functions in the AST to make them more
flexible by using `Type' ident` rather than `Type` in their signatures (the
latter fixes `ident` to be `Ident`). Changed functions: `isAlias`,
`isPrimTypeOf`, `isVector`, `isVectorOf`, `isArray`, and `isPointer`.

## 0.12.1.0 (August 2024)

* Fix for printing NaN and infinite floating point values.
Expand Down
12 changes: 6 additions & 6 deletions src/Text/LLVM/AST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ isFloatingPoint :: PrimType -> Bool
isFloatingPoint (FloatType _) = True
isFloatingPoint _ = False

isAlias :: Type -> Bool
isAlias :: Type' ident -> Bool
isAlias Alias{} = True
isAlias _ = False

isPrimTypeOf :: (PrimType -> Bool) -> Type -> Bool
isPrimTypeOf :: (PrimType -> Bool) -> Type' ident -> Bool
isPrimTypeOf p (PrimType pt) = p pt
isPrimTypeOf _ _ = False

Expand All @@ -496,20 +496,20 @@ isInteger :: PrimType -> Bool
isInteger Integer{} = True
isInteger _ = False

isVector :: Type -> Bool
isVector :: Type' ident -> Bool
isVector Vector{} = True
isVector _ = False

isVectorOf :: (Type -> Bool) -> Type -> Bool
isVectorOf :: (Type' ident -> Bool) -> Type' ident -> Bool
isVectorOf p (Vector _ e) = p e
isVectorOf _ _ = False

isArray :: Type -> Bool
isArray :: Type' ident -> Bool
isArray ty = case ty of
Array _ _ -> True
_ -> False

isPointer :: Type -> Bool
isPointer :: Type' ident -> Bool
isPointer (PtrTo _) = True
isPointer PtrOpaque = True
isPointer _ = False
Expand Down

0 comments on commit ea0ad98

Please sign in to comment.