|
| Language.C.Analysis.DefTable | | Portability | ghc | | Stability | alpha | | Maintainer | benedikt.huber@gmail.com |
|
|
|
| Description |
This module manages symbols in local and global scopes.
There are four different kind of identifiers: ordinary identifiers (henceforth
simply called identifier), tag names (names of struct/union/enum types),
labels and structure members.
|
|
| Synopsis |
|
|
|
| Documentation |
|
|
| All ordinary identifiers map to IdenTyDecl: either a typedef or a object/function/enumerator
|
|
|
|
|
| Tag names map to forward declarations or definitions of struct/union/enum types
|
|
|
|
|
|
| Table holding current definitions
| | Constructors | | DefTable | | | identDecls :: NameSpaceMap Ident IdentEntry | declared `ordinary identifiers'
| | tagDecls :: NameSpaceMap SUERef TagEntry | declared structunionenum tags
| | labelDefs :: NameSpaceMap Ident Ident | defined labels
| | memberDecls :: NameSpaceMap Ident MemberDecl | member declarations (only local)
| | refTable :: IntMap Name | link names with definitions
|
|
|
|
|
|
| empty definition table, with all name space maps in global scope
|
|
|
| get the globally defined entries of a definition table
|
|
|
| Enter function scope (and the corresponding block scope)
|
|
|
| Leave function scope, and return the associated DefTable.
Error if not in function scope.
|
|
|
| Enter new block scope
|
|
|
| Leave innermost block scope
|
|
|
| Enter new member declaration scope
|
|
|
| Leave innermost member declaration scope
|
|
| data DeclarationStatus t | Source |
|
| Status of a declaration
| | Constructors | | NewDecl | new entry
| | Redeclared t | old def was overwritten
| | KeepDef t | new def was discarded
| | Shadowed t | new def shadows one in outer scope
| | KindMismatch t | kind mismatch
|
|
|
|
|
|
|
|
|
declare/define a global object/function/typeDef
returns Redeclared def if there is already an object/function/typeDef
in global scope, or DifferentKindRedec def if the old declaration is of a different kind.
|
|
|
declare/define a object/function/typeDef with lexical scope
returns Redeclared def or DifferentKindRedec def if there is already an object/function/typeDef
in the same scope.
|
|
|
declare/define a object/function/typeDef with lexical scope, if the given predicate holds on the old
entry.
returns Keep old_def if the old definition shouldn't be overwritten, and otherwise Redeclared def or
DifferentKindRedec def if there is already an object/function/typeDef in the same scope.
|
|
|
| declare a tag (fwd decl in case the struct name isn't defined yet)
|
|
|
| define a tag
|
|
|
| define a label
Return the old label if it is already defined in this function's scope
|
|
|
| lookup identifier (object, function, typeDef, enumerator)
|
|
|
| lookup tag
|
|
|
| lookup label
|
|
|
| lookup an object in the innermost scope
|
|
|
| lookup an identifier in the innermost scope
|
|
| Produced by Haddock version 2.6.0 |