Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More parameterization for functions not needing a specialized type parameter. #150

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading