de.fosd.typechef.typesystem

CTypeSystem

trait CTypeSystem extends CTypes with CEnv with CDeclTyping with CTypeEnv with CExprTyping with CBuiltIn with CDeclUseInterface

checks an AST (from CParser) for type errors (especially dangling references)

performs type checking in a single tree-walk, uses lookup functions from various traits

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CTypeSystem
  2. CBuiltIn
  3. CExprTyping
  4. CTypeEnv
  5. CDeclTyping
  6. CDeclUseInterface
  7. CTypeSystemInterface
  8. CEnv
  9. CTypes
  10. COptionProvider
  11. AnyRef
  12. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type EnumEnv = Map[String, (FeatureExpr, Id)]

    Enum Environment: Just a set of names that are valid enums.

    Enum Environment: Just a set of names that are valid enums. No need to remember fields etc, because they are integers anyway and no further checking is done in C

    Definition Classes
    CEnv
  2. class Env extends AnyRef

    Attributes
    protected
    Definition Classes
    CEnv
  3. type LabelEnv = Map[String, FeatureExpr]

    label environment: stores which labels are reachable from a goto.

    label environment: stores which labels are reachable from a goto.

    the environment is filled upon function entry for the entire function and just stores under which condition a label is defined

    Definition Classes
    CEnv
  4. type PtrEnv = Set[String]

    Definition Classes
    CTypes
  5. class StructEnv extends AnyRef

    Definition Classes
    CEnv
  6. case class StructTag(isComplete: Boolean, fields: ConditionalTypeMap, scope: Int, id: Option[Id] = scala.None) extends Product with Serializable

    for struct and union ConditionalTypeMap represents for the fields of the struct

  7. case class VAnyInt() extends VValue with Product with Serializable

  8. case class VInt(v: Int) extends VValue with Product with Serializable

  9. case class VUnknown() extends VValue with Product with Serializable

  10. sealed trait VValue extends AnyRef

  11. type VarTypingContext = ConditionalVarEnv

    *** Variable-Typing context (collects all top-level and local declarations) variables with local scope overwrite variables with global scope

    *** Variable-Typing context (collects all top-level and local declarations) variables with local scope overwrite variables with global scope

    Definition Classes
    CEnv

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object EmptyEnv extends Env

    Definition Classes
    CEnv
  7. def addAnonStructUse(id: Id, fields: ConditionalTypeMap): Unit

    Definition Classes
    CDeclUseInterface
  8. def addDecl(current: Any, featureExpr: FeatureExpr, env: Env, isDefinition: Boolean = true): Unit

    Definition Classes
    CDeclUseInterface
  9. def addDefinition(definition: AST, env: Env, feature: FeatureExpr = FeatureExprFactory.True, isFunctionDeclarator: Boolean = false): Unit

    Definition Classes
    CDeclUseInterface
  10. def addEnumDeclarationToEnv(specifiers: List[Opt[Specifier]], featureExpr: FeatureExpr, env: Env, isHeadless: Boolean): EnumEnv

    Definition Classes
    CTypeEnv
  11. def addEnumUse(entry: AST, env: Env, feature: FeatureExpr): Unit

    Definition Classes
    CDeclUseInterface
  12. def addEnv(ast: AST, env: Env): Unit

    invoked before every external decl, statement and expression with the environment of that node

    invoked before every external decl, statement and expression with the environment of that node

    for example to debug the environment

    mixed in from CEnvCache

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  13. def addJumpStatements(compoundStatement: CompoundStatement): Unit

    Definition Classes
    CDeclUseInterface
  14. def addOldStyleParameters(oldStyleParameters: List[Opt[OldParameterDeclaration]], declarator: Declarator, expr: FeatureExpr, env: Env): Unit

    Definition Classes
    CDeclUseInterface
  15. def addStructDeclUse(entry: Id, env: Env, isUnion: Boolean, feature: FeatureExpr): Unit

    Definition Classes
    CDeclUseInterface
  16. def addStructDeclarationToEnv(specifier: Specifier, featureExpr: FeatureExpr, initEnv: Env, declareIncompleteTypes: Boolean): Env

    Definition Classes
    CTypeEnv
  17. def addStructDeclarationToEnv(specifiers: List[Opt[Specifier]], featureExpr: FeatureExpr, initEnv: Env, declareIncompleteTypes: Boolean): Env

    Definition Classes
    CTypeEnv
  18. def addStructDeclarationToEnv(e: StructDeclaration, featureExpr: FeatureExpr, env: Env): Env

    Definition Classes
    CTypeEnvCDeclTyping
  19. def addStructDeclarationToEnv(e: Declaration, featureExpr: FeatureExpr, env: Env): Env

    * Structs

    * Structs

    Definition Classes
    CTypeEnv
  20. def addStructDefinition(definition: AST, env: Env, feature: FeatureExpr): Unit

    Definition Classes
    CDeclUseInterface
  21. def addStructRedeclaration(env: Env, declaration: Id, feature: FeatureExpr, isUnion: Boolean): Unit

    Definition Classes
    CDeclUseInterface
  22. def addStructUse(entry: AST, featureExpr: FeatureExpr, env: Env, structName: String, isUnion: Boolean): Unit

    Definition Classes
    CDeclUseInterface
  23. def addTypeUse(entry: AST, env: Env, feature: FeatureExpr): Unit

    Definition Classes
    CDeclUseInterface
  24. def addUse(entry: AST, feature: FeatureExpr, env: Env): Unit

    Definition Classes
    CDeclUseInterface
  25. def arrayType(t: CType): Boolean

    Definition Classes
    CTypes
  26. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  27. def assertTypeSystemConstraint(condition: Boolean, featureExpr: FeatureExpr, msg: String, where: AST): Boolean

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  28. def checkEnumInitializer(initializer: Expr, fexpr: FeatureExpr, env: Env): Unit

    Attributes
    protected
    Definition Classes
    CTypeSystemCDeclTyping
  29. def checkStructCompleteness(ctype: CType, expr: FeatureExpr, env: Env, where: AST, checkedStructs: List[String] = Nil): Unit

    ensure that the type is complete in the given environment

    ensure that the type is complete in the given environment

    used for example when declaring or dereferencing a variable

    Attributes
    protected
    Definition Classes
    CDeclTyping
  30. def checkStructCompletenessC(ctype: Conditional[CType], expr: FeatureExpr, env: Env, where: AST, checkedStructs: List[String] = Nil): Unit

    Attributes
    protected
    Definition Classes
    CDeclTyping
  31. def checkStructRedeclaration(name: String, isUnion: Boolean, featureExpr: FeatureExpr, scope: Int, env: Env, where: AST): Unit

    Definition Classes
    CTypeEnv
  32. def checkTypeDeclaratorExtension(declExt: DeclaratorExtension, expr: FeatureExpr, env: Env): Unit

  33. def checkTypeDeclaratorExtensions(declExts: List[Opt[DeclaratorExtension]], expr: FeatureExpr, env: Env): Unit

  34. def checkTypeParam(declaration: ParameterDeclaration, expr: FeatureExpr, env: Env): Unit

  35. def checkTypePointers(pointers: List[Opt[Pointer]], expr: FeatureExpr, env: Env): Unit

  36. def checkTypeStructDecl(decl: StructDecl, expr: FeatureExpr, env: Env): Unit

  37. def checkTypeStructDeclaration(declaration: StructDeclaration, expr: FeatureExpr, env: Env): Unit

  38. def checkingExternal(externalDef: ExternalDef): Unit

    invoked before checking an external declaration (for example used for progress reports)

    invoked before checking an external declaration (for example used for progress reports)

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  39. def clearDeclUseMap(): Unit

    Definition Classes
    CDeclUseInterface
  40. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. def coerce(expectedType: CType, foundType: CType): Boolean

    determines whether types are compatible in assignements etc

    determines whether types are compatible in assignements etc

    for "a=b;" with a:type1 and b:type2

    Definition Classes
    CTypes
  42. def constructType(specifiers: List[Opt[Specifier]], featureExpr: FeatureExpr, env: Env, locationForErrorMsg: AST): Conditional[CType]

    Definition Classes
    CDeclTyping
  43. def containsIgnore(aType: AType): Boolean

  44. def containsIgnore(cType: CType): Boolean

  45. def converse(a: CType, b: CType): CType

    ansi c conversion rules of two arithmetic types (if called on other types, it just returns the first type; hence the pattern if cocerce(x,y) return converse(x,y) should yield the default behavior )

    ansi c conversion rules of two arithmetic types (if called on other types, it just returns the first type; hence the pattern if cocerce(x,y) return converse(x,y) should yield the default behavior )

    default is int. if either operand has a higher priority, it is preferred over int

    according to specification: http://techpubs.sgi.com/library/manuals/0000/007-0701-150/pdf/007-0701-150.pdf

    Definition Classes
    CTypes
  46. def declType(specs: List[Opt[Specifier]], decl: Declarator, attributes: List[Opt[AttributeSpecifier]], featureExpr: FeatureExpr, env: Env, oldStyleParameterTypes: ConditionalTypeMap = null): Conditional[CType]

    oldStyleParameterTypes

    only used when resolving a function

    Definition Classes
    CDeclTyping
  47. def enumDeclarations(specs: List[Opt[Specifier]], featureExpr: FeatureExpr, d: AST, env: Env): List[(String, FeatureExpr, AST, Conditional[CType], DeclarationKind, Conditional[Linkage])]

    define all fields from enum type specifiers as int values

    define all fields from enum type specifiers as int values

    enum is always interpreted as definition, not declaration. it conflicts with other definitions and other declarations.

    important: this recurses into structures!

    Attributes
    protected
    Definition Classes
    CDeclTyping
  48. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  49. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  50. def executeOp(op: String, ca: Conditional[VValue], cb: Conditional[VValue]): Conditional[VValue]

  51. def filterDeadSpecifiers[T](l: List[Opt[T]], ctx: FeatureExpr): List[Opt[T]]

    filtering is a workaround for a parsing problem (see open test) that can produce False AST-subtrees in some combinations.

    filtering is a workaround for a parsing problem (see open test) that can produce False AST-subtrees in some combinations.

    remove when problem is fixed

    Attributes
    protected
    Definition Classes
    CDeclTyping
  52. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  53. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  54. def getDeclarationType(specifiers: List[Opt[Specifier]], decl: Declarator, featureExpr: FeatureExpr, env: Env): Conditional[CType]

    Attributes
    protected
    Definition Classes
    CDeclTyping
  55. def getDeclaratorType(decl: Declarator, returnType: Conditional[CType], featureExpr: FeatureExpr, env: Env, oldStyleParameterTypes: ConditionalTypeMap = null): Conditional[CType]

    Attributes
    protected
    Definition Classes
    CDeclTyping
  56. def getDeclaredVariables(decl: Declaration, featureExpr: FeatureExpr, env: Env, checkInitializer: (Expr, Conditional[CType], FeatureExpr, Env) ⇒ Unit = noInitCheck): (Env, List[(String, FeatureExpr, AST, Conditional[CType], DeclarationKind, Conditional[Linkage])])

    get a list of all declared variables from a declaration.

    get a list of all declared variables from a declaration. also checks that declarations are wellformed (e.g., structs are complete)

    Definition Classes
    CDeclTyping
  57. def getExprType(expr: Expr, featureExpr: FeatureExpr, env: Env): Conditional[CType]

    types an expression in an environment, returns a new environment for all subsequent tokens (eg in a sequence)

    types an expression in an environment, returns a new environment for all subsequent tokens (eg in a sequence)

    Definition Classes
    CExprTypingCDeclTyping
  58. def getExprTypeRec(expr: Expr, featureExpr: FeatureExpr, env: Env, recurse: Boolean = false): Conditional[CType]

    Definition Classes
    CExprTyping
  59. def getExternCondition(specifiers: List[Opt[Specifier]]): FeatureExpr

    Attributes
    protected
    Definition Classes
    CDeclTyping
  60. def getFunctionType(specifiers: List[Opt[Specifier]], declarator: Declarator, oldStyleParameters: ConditionalTypeMap, featureExpr: FeatureExpr, env: Env): Conditional[CType]

    Definition Classes
    CDeclTyping
  61. def getIsExtern(list: List[Opt[Specifier]]): FeatureExpr

    under which condition is modifier extern defined?

    under which condition is modifier extern defined?

    Definition Classes
    CDeclTyping
  62. def getLinkage(symbol: String, isFunctionDef: Boolean, specifiers: List[Opt[Specifier]], fexpr: FeatureExpr, env: Env, where: AST): Conditional[Linkage]

    linkage depends on previous identifiers in scope, on the scope (file level or not) and the specifiers

    linkage depends on previous identifiers in scope, on the scope (file level or not) and the specifiers

    see http://publications.gbdirect.co.uk/c_book/chapter8/declarations_and_definitions.html

    Attributes
    protected
    Definition Classes
    CDeclTyping
  63. def getOldStyleParameters(oldStyleParameters: List[Opt[OldParameterDeclaration]], featureExpr: FeatureExpr, env: Env): ConditionalTypeMap

    Attributes
    protected
    Definition Classes
    CDeclTyping
  64. def getSpecifierCondition(specifiers: List[Opt[Specifier]], specifier: Specifier): FeatureExpr

    Attributes
    protected
    Definition Classes
    CDeclTyping
  65. def getStaticCondition(specifiers: List[Opt[Specifier]]): FeatureExpr

    Attributes
    protected
    Definition Classes
    CDeclTyping
  66. def getStmtType(stmt: Statement, featureExpr: FeatureExpr, env: Env): (Conditional[CType], Env)

    returns a type and a changed environment for subsequent statements

    returns a type and a changed environment for subsequent statements

    most statements do not have types; type information extracted from sparse (evaluate.c)

    Definition Classes
    CTypeSystemCExprTyping
  67. def getTypenameType(typename: TypeName, featureExpr: FeatureExpr, env: Env): Conditional[CType]

    Definition Classes
    CDeclTyping
  68. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  69. def init(): Unit

    Definition Classes
    CDeclUseInterface
  70. val initBuiltinTypedevEnv: Seq[(String, FeatureExpr, (AST, Conditional[CType]))]

    Definition Classes
    CBuiltIn
  71. lazy val initBuiltinVarEnv: Seq[(String, FeatureExpr, AST, Conditional[CType], DeclarationKind, Int, Linkage)]

    Definition Classes
    CBuiltIn
  72. lazy val initialEnv: Env

    Definition Classes
    CBuiltIn
  73. def isArithmetic(t: CType): Boolean

    Definition Classes
    CTypes
  74. def isArray(t: CType): Boolean

    Definition Classes
    CTypes
  75. def isCharSignCoercion(a: AType, b: AType): Boolean

    are both types char but with different signage?

    are both types char but with different signage?

    Attributes
    protected
    Definition Classes
    CTypes
  76. def isCompound(t: CType): Boolean

    Definition Classes
    CTypes
  77. def isForcedCoercion(expectedType: AType, foundType: AType): Boolean

    we can report as a warning if both types are number, but they are not the same width or signed

    we can report as a warning if both types are number, but they are not the same width or signed

    Definition Classes
    CTypes
  78. def isFunction(t: CType): Boolean

    Definition Classes
    CTypes
  79. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  80. def isIntegral(t: CType): Boolean

    Definition Classes
    CTypes
  81. def isPointer(t: CType): Boolean

    Definition Classes
    CTypes
  82. def isScalar(t: CType): Boolean

    Definition Classes
    CTypes
  83. def isStruct(t: CType): Boolean

    Definition Classes
    CTypes
  84. def isTypedef(specs: List[Opt[Specifier]]): Boolean

    Definition Classes
    CDeclTyping
  85. def isZero(t: CType): Boolean

    Definition Classes
    CTypes
  86. def issueTypeError(severity: Severity, condition: FeatureExpr, msg: String, where: AST, severityExtra: String = ""): Unit

    error reporting for type errors

    error reporting for type errors

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  87. def markSecurityRelevantFunctions(funname: String, ctype: Conditional[CType]): Conditional[CType]

    hardcoding of functions for which parameters are considered security relevant parameters of these functions are checked for integer overflows

    hardcoding of functions for which parameters are considered security relevant parameters of these functions are checked for integer overflows

    Definition Classes
    CExprTyping
  88. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  89. def normalize(t: AType): AType

    Attributes
    protected
    Definition Classes
    CTypes
  90. def normalize(t: CType): CType

    normalize types for internal comparison in coerce (do not return this to the outside)

    normalize types for internal comparison in coerce (do not return this to the outside)

    * function -> pointer to function

    * pointer to pointer to function -> pointer to function

    * remove any CObj within the type

    * regard arrays as pointers

    * pointer to ignore equals ignore

    * CVoid in function parameters is removed

    Attributes
    protected
    Definition Classes
    CTypes
  91. final def notify(): Unit

    Definition Classes
    AnyRef
  92. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  93. def opts: ICTypeSysOptions

    Attributes
    protected
    Definition Classes
    COptionProvider
  94. final def parameterTypes(decl: Declarator, featureExpr: FeatureExpr, env: Env, oldStyleParam: ConditionalTypeMap): List[(String, FeatureExpr, AST, Conditional[CType])]

    get the parameters from the innermost declarator.

    get the parameters from the innermost declarator. all outer (nested) declarators describe only arrays or parameters of the return type, if the function returns a function

    Attributes
    protected
    Definition Classes
    CTypeEnv
  95. def parseStructMembers(members: List[Opt[StructDeclaration]], featureExpr: FeatureExpr, initialEnv: Env): ConditionalTypeMap

    Definition Classes
    CDeclTyping
  96. def promote(x: CType): CType

    promotion is what happens internally during conversion

    promotion is what happens internally during conversion

    Definition Classes
    CTypes
  97. def recognizeTypedefs(decl: Declaration, featureExpr: FeatureExpr, env: Env): Seq[(String, FeatureExpr, (AST, Conditional[CType]))]

    Attributes
    protected
    Definition Classes
    CDeclTyping
  98. final def reportTypeError(featureExpr: FeatureExpr, txt: String, where: AST, severity: Severity = Severity.OtherError, severityExtra: String = ""): CUnknown

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  99. def sizeofType(env: Env, x: AST, featureExpr: FeatureExpr): Conditional[CType]

    sizeof() has type Any->size_t.

    sizeof() has type Any->size_t. Type size_t is defined in individual header files (e.g. stddef.h) of the system though and may not be defined in all cases. here we look up the type of size_t and return an int in case it fails

    Definition Classes
    CExprTyping
  100. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  101. implicit def toCType(x: CLong): AType

    Definition Classes
    CTypes
  102. implicit def toCType(x: CShort): AType

    Definition Classes
    CTypes
  103. implicit def toCType(x: CChar): AType

    Definition Classes
    CTypes
  104. implicit def toCType(x: CInt): AType

    Definition Classes
    CTypes
  105. def toString(): String

    Definition Classes
    AnyRef → Any
  106. def typecheckTranslationUnit(tunit: TranslationUnit, featureModel: FeatureExpr = FeatureExprFactory.True): Unit

  107. def typedExpr(expr: Expr, ctype: Conditional[CType], featureExpr: FeatureExpr, env: Env): Unit

    invoked after typing an expression

    invoked after typing an expression

    refined by CTypeCache if desired

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  108. def typedFunction(fun: FunctionDef, ctype: Conditional[CType], featureExpr: FeatureExpr): Unit

    invoked after typing a function definition (top level declaration, not nested function)

    invoked after typing a function definition (top level declaration, not nested function)

    Attributes
    protected
    Definition Classes
    CTypeSystemInterface
  109. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  110. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  111. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  112. def wellformed(structEnv: StructEnv, ptrEnv: PtrEnv, atype: AType): Boolean

    Definition Classes
    CTypeEnv
  113. def wellformed(structEnv: StructEnv, ptrEnv: PtrEnv, atype: Conditional[AType]): Boolean

    Definition Classes
    CTypeEnv
  114. def wellformedC(structEnv: StructEnv, ptrEnv: PtrEnv, ctype: Conditional[CType]): Boolean

    Definition Classes
    CTypeEnv
  115. def wider(t1: CType, t2: CType): CType

    returns the wider of two types for automatic widening

    returns the wider of two types for automatic widening

    Definition Classes
    CExprTyping

Inherited from CBuiltIn

Inherited from CExprTyping

Inherited from CTypeEnv

Inherited from CDeclTyping

Inherited from CDeclUseInterface

Inherited from CTypeSystemInterface

Inherited from CEnv

Inherited from CTypes

Inherited from COptionProvider

Inherited from AnyRef

Inherited from Any

Ungrouped