Frama-C API - Ast_info
AST manipulation utilities.
Expressions
val is_integral_const : Cil_types.constant -> booltrue iff the constant is an integer constant (i.e. neither a float nor a string). Enum tags and chars are integer constants.
val possible_value_of_integral_const : Cil_types.constant -> Z.t optionreturns the value of the corresponding integer literal or None if the constant is not an integer (i.e. is_integral_const returns false).
val possible_value_of_integral_expr : Cil_types.exp -> Z.t optionreturns the value of the corresponding integer constant expression, or None if the expression is not a constant expression or does not evaluate to an integer constant.
val value_of_integral_const : Cil_types.constant -> Z.treturns the value of the corresponding integer literal. It is the responsibility of the caller to ensure the constant is indeed an integer constant. If unsure, use possible_value_of_integral_const.
val value_of_integral_expr : Cil_types.exp -> Z.treturns the value of the corresponding integer constant expression. It is the responsibility of the caller to ensure that the argument is indeed an integer constant expression. If unsure, use possible_value_of_integral_expr.
val is_null_expr : Cil_types.exp -> booltrue iff the expression is a constant expression that evaluates to a null pointer, i.e. 0 or a cast to 0.
val is_non_null_expr : Cil_types.exp -> booltrue iff the expression is a constant expression that evaluates to a non-null pointer.
Warning: note that for the purpose of this function &x is not a constant expression, hence the function will return false in this case.
val is_string_literal : Cil_types.varinfo -> booltrue if the varinfo is a global variable representing a string literal.
Logical terms
val is_integral_logic_const : Cil_types.logic_constant -> boolval possible_value_of_integral_logic_const : Cil_types.logic_constant -> Z.t optionval value_of_integral_logic_const : Cil_types.logic_constant -> Z.tval possible_value_of_integral_term : Cil_types.term -> Z.t optionval term_lvals_of_term : Cil_types.term -> Cil_types.term_lval listval precondition : goal:bool -> Cil_types.funspec -> Cil_types.predicateBuilds the precondition from b_assumes and b_requires clauses. With ~goal:true, only returns assert and check predicates. With ~goal:false, only returns assert and admit predicates.
val behavior_assumes : Cil_types.funbehavior -> Cil_types.predicateBuilds the conjunction of the b_assumes.
val behavior_precondition : goal:bool -> Cil_types.funbehavior -> Cil_types.predicateBuilds the precondition from b_assumes and b_requires clauses. For flag ~goal see Ast_info.precondition above.
val behavior_postcondition : goal:bool -> Cil_types.funbehavior -> Cil_types.termination_kind -> Cil_types.predicateBuilds the postcondition from b_assumes and b_post_cond clauses. For flag ~goal see Ast_info.precondition above.
val disjoint_behaviors : Cil_types.funspec -> string list -> Cil_types.predicateBuilds the disjoint_behaviors property for the behavior names.
val complete_behaviors : Cil_types.funspec -> string list -> Cil_types.predicateBuilds the disjoint_behaviors property for the behavior names.
val merge_assigns_from_complete_bhvs : ?warn:bool -> ?unguarded:bool -> Cil_types.funbehavior list -> string list list -> Cil_types.assignsval merge_assigns_from_spec : ?warn:bool -> Cil_types.funspec -> Cil_types.assignsIt is a shortcut for merge_assigns_from_complete_bhvs spec.spec_complete_behaviors spec.spec_behavior. Optional warn argument can be used to force emitting or cancelation of warnings
val merge_assigns : ?warn:bool -> Cil_types.funbehavior list -> Cil_types.assignsReturns the assigns of an unguarded behavior. Optional warn argument can be used to force emitting or cancelation of warnings.
val variable_term : Cil_types.location -> Cil_types.logic_var -> Cil_types.termval constant_term : Cil_types.location -> Z.t -> Cil_types.termval is_null_term : Cil_types.term -> boolStatements
val is_loop_statement : Cil_types.stmt -> boolval get_sid : Cil_types.kinstr -> intval mkassign : Cil_types.lval -> Cil_types.exp -> Cil_types.location -> Cil_types.instrval mkassign_statement : Cil_types.lval -> Cil_types.exp -> Cil_types.location -> Cil_types.stmtval is_block_local : Cil_types.varinfo -> Cil_types.block -> booldetermines if a var is local to a block.
val block_of_local : Cil_types.fundec -> Cil_types.varinfo -> Cil_types.blocklocal_block f vi returns the block of f in which vi is declared. vi must be a variable of f.
Types
val direct_array_size : Cil_types.typ -> Z.tval array_size : Cil_types.typ -> Z.tFunctions
module Function : sig ... endOperations on cil function.
Predefined
val is_frama_c_builtin : Cil_types.varinfo -> bool