Increase size of biniou buffer, add logging in case of failure

Summary:public
Names of templated types can be very long. The default 4k characters is not long
enough to handle folly library. Increase it to 16k characters and log when deserialization
fails.

Reviewed By: jberdine

Differential Revision: D2948935

fb-gh-sync-id: a659b23
shipit-source-id: a659b23
master
Andrzej Kotulski 9 years ago committed by facebook-github-bot-7
parent 77b22ded03
commit 941a1c02fb

@ -94,13 +94,24 @@ let print_usage_exit () =
let () =
Utils.Arg.parse arg_desc (fun _ -> ()) usage
let buffer_len = 16384
(* This function reads the json file in fname, validates it, and encoded in the AST data structure*)
(* defined in Clang_ast_t. *)
let validate_decl_from_file fname =
Ag_util.Biniou.from_file Clang_ast_b.read_decl fname
try
Ag_util.Biniou.from_file ~len:buffer_len Clang_ast_b.read_decl fname
with (Invalid_argument "Bi_inbuf.refill_from_channel") ->
Printing.log_stats "WARNING: biniou buffer too short, skipping the file\n";
assert false
let validate_decl_from_stdin () =
Ag_util.Biniou.from_channel Clang_ast_b.read_decl stdin
try
Ag_util.Biniou.from_channel ~len:buffer_len Clang_ast_b.read_decl stdin
with (Invalid_argument "Bi_inbuf.refill_from_channel") ->
Printing.log_stats "WARNING: biniou buffer too short, skipping the file\n";
assert false
let do_run source_path ast_path =
try

Loading…
Cancel
Save