language-c-0.9: Analysis and generation of C code
Safe HaskellNone
LanguageHaskell98

Language.C.Analysis.TypeUtils

Synopsis

Constructors

integral :: IntType -> Type Source #

Constructor for a simple integral type.

floating :: FloatType -> Type Source #

Constructor for a simple floating-point type.

simplePtr :: Type -> Type Source #

A simple pointer with no qualifiers

uint16_tType :: Type Source #

The underlying type for uint16_t. For now, this is just unsigned short.

uint32_tType :: Type Source #

The underlying type for uint32_t. For now, this is just unsigned int.

uint64_tType :: Type Source #

The underlying type for uint64_t. For now, this is just unsigned long long.

size_tType :: Type Source #

The type returned by sizeof (size_t). For now, this is just int.

ptrDiffType :: Type Source #

The type of pointer differences (ptrdiff_t). For now, this is just int.

boolType :: Type Source #

The type of comparisons/guards. This is always just int.

voidType :: Type Source #

Simple void type.

voidPtr :: Type Source #

An unqualified void pointer.

constVoidPtr :: Type Source #

A const-qualified void pointer.

charPtr :: Type Source #

An unqualified char pointer.

constCharPtr :: Type Source #

A const-qualified char pointer.

stringType :: Type Source #

The type of a constant string.

valistType :: Type Source #

The builtin type of variable-length argument lists.

Classifiers

isIntegralType :: Type -> Bool Source #

Check whether a type is an integral type. This includes enum types. This function does not attempt to resolve typedef types.

isFloatingType :: Type -> Bool Source #

Check whether a type is a floating-point numeric type. This function does not attempt to resolve typedef types.

isPointerType :: Type -> Bool Source #

Check whether a type is an pointer type. This includes array types. This function does not attempt to resolve typedef types.

isScalarType :: Type -> Bool Source #

Check whether a type is a scalar type. Scalar types include arithmetic types and pointer types.

isFunctionType :: Type -> Bool Source #

return True if the given type is a function type

Result is undefined in the presence of undefined typeDefs

typeQuals :: Type -> TypeQuals Source #

Return the qualifiers of a type.

typeAttrs :: Type -> Attributes Source #

Return the attributes of a type.

baseType :: Type -> Type Source #

Return the base type of a pointer or array type. It is an error to call this function with a type that is not in one of those two categories.

derefTypeDef :: Type -> Type Source #

resolve typedefs, if possible

deepDerefTypeDef :: Type -> Type Source #

Attempt to remove all references to typedef types from a given type. Note that this does not dereference the types of structure or union fields, so there are still cases where further dereferencing is needed.

Type comparisons

sameType :: Type -> Type -> Bool Source #

Two types denote the same type if they are identical, ignoring type definitions, and neither is a variably modified type.

Other utilities