package mopsa

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

Module Lang.FrontendSource

C front-end to translate parser AST into MOPSA AST

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

Command-line options

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

Sourceval opt_clang : string list Stdlib.ref

Extra options to pass to clang when parsing

Sourceval opt_include_dirs : string list Stdlib.ref

List of include directories

Sourceval opt_make_target : string Stdlib.ref

Name of the target binary to analyze

Sourceval opt_without_libc : bool Stdlib.ref

Disable stubs of the standard library

Sourceval opt_enable_cache : bool Stdlib.ref

Enable the parser cache.

Sourceval opt_warn_all : bool Stdlib.ref

Display all compiler warnings

Sourceval opt_use_stub : string list Stdlib.ref

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

Sourceval opt_library_only : bool Stdlib.ref

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

Sourceval opt_target_triple : string Stdlib.ref

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

Sourceval opt_stubs_files : string list Stdlib.ref

Additional stub files to parse

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

List of translation units to ignore during linking

Sourceval opt_save_preprocessed_file : string Stdlib.ref

Where to save the preprocessed file

Sourceval opt_store_project : bool Stdlib.ref

Store project in memory for automated testcase reduction capabilities

Contexts

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

Sourcetype type_space =
  1. | TS_TYPEDEF
  2. | TS_RECORD
  3. | TS_ENUM
Sourcetype 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;
}
Sourceval input_files : string list Stdlib.ref

List of input files

Sourceval target_info : Mopsa_c_parser.Clang_AST.target_info Stdlib.ref

Target information used for parsing

Sourceval o_prj : Mopsa_c_parser.C_AST.project option Stdlib.ref

Saved project

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

Entry point

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

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

functions

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

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

Scope update

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

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

Statements

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

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

Expressions

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

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

Variables

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

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

Types

=========

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

Ranges and locations

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

Stubs annotations

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

Sourceval from_stub_comment : ctx -> Mopsa_c_parser.C_AST.func -> Stubs.Ast.stub_func option
Sourceval from_stub_section : ctx -> Parsing.Ast.section -> Stubs.Ast.section
Sourceval from_stub_leaf : ctx -> Parsing.Ast.leaf -> Stubs.Ast.leaf
Sourceval from_stub_case : ctx -> Parsing.Ast.case -> Stubs.Ast.case
Sourceval from_stub_local_value : ctx -> Parsing.Ast.local_value -> Stubs.Ast.local_value
Sourceval from_stub_formula : ctx -> Parsing.Ast.requires -> Stubs.Ast.requires
Sourceval from_stub_set : ctx -> Parsing.Ast.set -> Stubs.Ast.set
Sourceval from_stub_interval : ctx -> Parsing.Ast.interval -> Stubs.Ast.interval
Sourceval from_stub_expr : ctx -> Parsing.Ast.free -> Stubs.Ast.free
Sourceval from_stub_directive : ctx -> Parsing.Ast.stub -> Stubs.Ast.stub_directive
Sourceval on_panic : exn -> string list -> float -> unit
OCaml

Innovation. Community. Security.