Skip to content
Snippets Groups Projects
Commit c34eb69b authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[Builtin] Override Std becomes Builtin

parent 6c5f6649
No related branches found
No related tags found
No related merge requests found
OPT: @PTEST_FILE@ -builtin -print -check -then -ocode @PTEST_DIR@/result/@PTEST_NAME@.c -print -then @PTEST_DIR@/result/@PTEST_NAME@.c @PTEST_FILE@ -ocode="" -print
\ No newline at end of file
...@@ -22,25 +22,25 @@ ...@@ -22,25 +22,25 @@
open Cil_types open Cil_types
module type Override = sig module type Builtin = sig
val function_name: string val function_name: string
val replace_call: instr -> instr val replace_call: instr -> instr
val get_globals: location -> global list val get_globals: location -> global list
val mark_as_computed: ?project:Project.t -> unit -> unit val mark_as_computed: ?project:Project.t -> unit -> unit
end end
let base : (string, (module Override)) Hashtbl.t = Hashtbl.create 17 let base : (string, (module Builtin)) Hashtbl.t = Hashtbl.create 17
let register ((module M: Override) as m) = let register ((module M: Builtin) as m) =
Hashtbl.add base M.function_name m Hashtbl.add base M.function_name m
let mark_as_computed () = let mark_as_computed () =
let mark _ m = let module M = (val m: Override) in M.mark_as_computed () in let mark _ m = let module M = (val m: Builtin) in M.mark_as_computed () in
Hashtbl.iter mark base Hashtbl.iter mark base
let get_globals loc = let get_globals loc =
let get_globals m = let get_globals m =
let module M = (val m: Override) in let module M = (val m: Builtin) in
M.get_globals loc M.get_globals loc
in in
Hashtbl.fold (fun _ v l -> (get_globals v) @ l) base [] Hashtbl.fold (fun _ v l -> (get_globals v) @ l) base []
...@@ -62,7 +62,7 @@ let replace_call inst = ...@@ -62,7 +62,7 @@ let replace_call inst =
find_stdlib_attr_in_call inst ; find_stdlib_attr_in_call inst ;
let name = called_function_name inst in let name = called_function_name inst in
let m = Hashtbl.find base name in let m = Hashtbl.find base name in
let module M = (val m: Override) in let module M = (val m: Builtin) in
M.replace_call inst M.replace_call inst
with Not_found -> inst with Not_found -> inst
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
open Cil_types open Cil_types
module type Override = sig module type Builtin = sig
val function_name: string val function_name: string
val replace_call: instr -> instr val replace_call: instr -> instr
val get_globals: location -> global list val get_globals: location -> global list
val mark_as_computed: ?project:Project.t -> unit -> unit val mark_as_computed: ?project:Project.t -> unit -> unit
end end
val register: (module Override) -> unit val register: (module Builtin) -> unit
val transform: Cil_types.file -> unit val transform: Cil_types.file -> unit
OPT: @PTEST_FILE@ -override-std -print -check -then -ocode @PTEST_DIR@/result/@PTEST_NAME@.c -print -then @PTEST_DIR@/result/@PTEST_NAME@.c @PTEST_FILE@ -ocode="" -print
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment