package mopsa

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

C front-end to translate parser AST into MOPSA AST

val debug : ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

Command-line options

========================

val opt_clang : string list Stdlib.ref

Extra options to pass to clang when parsing

val opt_include_dirs : string list Stdlib.ref

List of include directories

val opt_make_target : string Stdlib.ref

Name of the target binary to analyze

val opt_without_libc : bool Stdlib.ref

Disable stubs of the standard library

val opt_enable_cache : bool Stdlib.ref

Enable the parser cache.

val opt_warn_all : bool Stdlib.ref

Display all compiler warnings

val opt_use_stub : string list Stdlib.ref

Lists of functions that the body will be replaced by a stub

val opt_library_only : bool Stdlib.ref

Allow library-only targets in the .db files (used for multilanguage analysis)

val opt_target_triple : string Stdlib.ref

Target architecture triple to analyze for (host if left empty)

val opt_stubs_files : string list Stdlib.ref

Additional stub files to parse

val opt_ignored_translation_units : Stdlib.String.t list Stdlib.ref

List of translation units to ignore during linking

Contexts

============

type type_space =
  1. | TS_TYPEDEF
  2. | TS_RECORD
  3. | TS_ENUM
type ctx = {
  1. ctx_prj : Mopsa_c_parser.C_AST.project;
  2. ctx_fun : C_lang__.Ast.c_fundec Mopsa_c_parser.C_AST.StringMap.t;
  3. ctx_type : (type_space * string, Mopsa.typ) Stdlib.Hashtbl.t;
  4. ctx_vars : (int * string, Mopsa.var * Mopsa_c_parser.C_AST.variable) Stdlib.Hashtbl.t;
  5. ctx_macros : Mopsa_c_parser.C_AST.macro Mopsa_c_parser.C_AST.StringMap.t;
  6. ctx_predicates : Mopsa_c_stubs_parser.Passes.Preprocessor.predicate Mopsa_c_parser.C_AST.StringMap.t;
  7. ctx_stubs : (string, Mopsa_c_stubs_parser.Cst.stub) Stdlib.Hashtbl.t;
  8. ctx_enums : Z.t Mopsa_c_parser.C_AST.StringMap.t;
}
val input_files : string list Stdlib.ref

List of input files

val target_info : Mopsa_c_parser.Clang_AST.target_info Stdlib.ref

Target information used for parsing

val find_function_in_context : ctx -> Utils_core.Location.range -> Mopsa_c_parser.C_AST.func -> C_lang__.Ast.c_fundec
val get_parsed_system_headers : Mopsa_c_parser.Clang_to_C.context -> string list
val get_all_stubs : unit -> string list
val find_stubs_of_header : string -> string list -> string list
val is_ignored_translation_unit : string -> bool

Entry point

===============

val parse_program : string list -> Mopsa.program
val parse_db : string -> Mopsa_c_parser.Clang_to_C.context -> unit
val parse_file : string -> ?nb:(int * int) -> ?stub:bool -> string list -> string -> bool -> bool -> Mopsa_c_parser.Clang_to_C.context -> unit
val parse_stubs : Mopsa_c_parser.Clang_to_C.context -> unit -> unit
val find_target : Stdlib.String.t -> string list -> string

functions

=============

val from_function : Mopsa_c_parser.C_AST.func -> C_lang__.Ast.c_fundec

Scope update

****************

val from_scope_update : ctx -> Mopsa_c_parser.C_AST.scope_update -> C_lang__.Ast.c_scope_update

Statements

==============

val from_body_option : ctx -> Mopsa.range -> Mopsa_c_parser.C_AST.block option -> Mopsa.stmt option

Expressions

===============

val from_expr_option : ctx -> Mopsa_c_parser.C_AST.expr option -> Mopsa.expr option
val from_character_kind : Mopsa_c_parser.C_AST.character_kind -> C_lang__.Ast.c_character_kind

Variables

=============

val patch_array_parameters : Mopsa.var -> Mopsa.var
val from_var_scope : ctx -> Mopsa_c_parser.C_AST.variable_kind -> C_lang__.Ast.c_var_scope
val from_var_init : ctx -> Mopsa_c_parser.C_AST.variable -> C_lang__.Ast.c_var_init option
val from_init_option : ctx -> Mopsa_c_parser.C_AST.init option -> C_lang__.Ast.c_var_init option
val from_init : ctx -> Mopsa_c_parser.C_AST.init -> C_lang__.Ast.c_var_init

Types

=========

val from_unqual_typ : ctx -> Mopsa_c_parser.C_AST.typ -> Mopsa.typ
val from_integer_type : Mopsa_c_parser.C_AST.integer_type -> C_lang__.Ast.c_integer_type
val from_float_type : Mopsa_c_parser.C_AST.float_type -> C_lang__.Ast.c_float_type
val from_array_length : ctx -> Mopsa_c_parser.C_AST.array_length -> C_lang__.Ast.c_array_length
val from_function_type : ctx -> Mopsa_c_parser.C_AST.function_type -> C_lang__.Ast.c_function_type
val find_field_index : Mopsa_c_parser.C_AST.type_qual -> string -> int

Ranges and locations

========================

Stubs annotations

=====================

val from_stub_comment : ctx -> Mopsa_c_parser.C_AST.func -> Stubs.Ast.stub_func option
val from_stub_section : ctx -> Parsing.Ast.section -> Stubs.Ast.section
val from_stub_leaf : ctx -> Parsing.Ast.leaf -> Stubs.Ast.leaf
val from_stub_case : ctx -> Parsing.Ast.case -> Stubs.Ast.case
val from_stub_message_kind : Parsing.Ast.message_kind -> Stubs.Ast.message_kind
val from_stub_local_value : ctx -> Parsing.Ast.local_value -> Stubs.Ast.local_value
val from_stub_formula : ctx -> Parsing.Ast.requires -> Stubs.Ast.requires
val from_stub_set : ctx -> Parsing.Ast.set -> Stubs.Ast.set
val from_stub_interval : ctx -> Parsing.Ast.interval -> Stubs.Ast.interval
val from_stub_expr : ctx -> Parsing.Ast.free -> Stubs.Ast.free
val from_stub_log_binop : Parsing.Ast.log_binop -> Stubs.Ast.log_binop
val from_stub_directive : ctx -> Parsing.Ast.stub -> Stubs.Ast.stub_directive
OCaml

Innovation. Community. Security.