package mopsa

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

Clang_to_C - Translates Clang AST to C AST and link C AST

type context

Abstract structure used internally during project parsing & linking.

val create_context : ?min_uid:int -> string -> Clang_AST.target_info -> context

create_context project_name target creates a new project (i.e., a program made of several translation units accumulated) with the given name and target. Returns a context to manipulate the project.

val add_translation_unit : context -> string -> Clang_AST.decl -> string list -> Clang_AST.comment list -> Clang_AST.macro list -> bool -> unit

add_translation_unit context name decl files coms macros keep_static converts a Clang definition of a translation unit with the given name (generally, the source C file) into a cAST and accumulates the definition to the projet. Remove static functions unused in the translation unit, unless keep_static is true (useful for sutb files).

link_project context links all the translation units accumulated in the project and returns the consolidated definitions.

val dump_decls : bool Stdlib.ref

dump each C declarations found, for debugging

val log_rename : bool Stdlib.ref

log when renaming (or assign a name to an anonymous)

val log_merge : bool Stdlib.ref
val log_remove : bool Stdlib.ref
val dump_dir : string Stdlib.ref

Log destination directory.

val simplify : bool Stdlib.ref
val new_uid : context -> C_AST.uid
val find_function : string -> context -> C_AST.func

Find a function by its name. Not_found is raised when the function is missing.

val get_parsed_files : context -> string list

Get the list of parsed files

OCaml

Innovation. Community. Security.