HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelanguage-c-0.9.3Haskell2010

Language.C.Analysis.DeclAnalysis

This module performs the analysis of declarations and the translation of type specifications in the AST.

  • 7 types
  • 18 values
  • Packagelanguage-c-0.9.3
  • Exports25
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDeclAnalysis.hs

Translating types

7 declarations
valueanalyseTypeDecl :: MonadTrav m => CDecl -> m Type
#

get the type of a type declaration

A type declaration T may appear in thre forms:

  • typeof(T)
  • as abstract declarator in a function prototype, as in f(int)

  • in a declaration without declarators, as in struct x { int a } ;

Currently, analyseTypeDecl is exlusively used for analysing types for GNU's typeof(T).

We move attributes to the type, as they have no meaning for the abstract declarator

convert old style parameters

This requires matching parameter names and declarations, as in the following example:

int f(d,c,a,b)
char a,*b;
int c;
{ }

is converted to

int f(int d, int c, char a, char* b)

TODO: This could be moved to syntax, as it operates on the AST only

Dissecting type specs

11 declarations

Helpers

7 declarations