Skip to content

Commit

Permalink
Resolve conflicts etc in tools/ (#2954)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored Aug 21, 2024
1 parent 175a365 commit 9eb2bc7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
22 changes: 16 additions & 6 deletions ocaml/driver/compile_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,20 @@ type info = {
let with_info ~native ~tool_name ~source_file ~output_prefix ~dump_ext k =
Compmisc.init_path ();
let target = Unit_info.make ~source_file output_prefix in
Env.set_unit_name (Unit_info.modname target);
let module_name = Compenv.module_of_filename source_file output_prefix in
let module_name = Unit_info.modname target in
let for_pack_prefix = Compilation_unit.Prefix.from_clflags () in
let compilation_unit =
Compilation_unit.create for_pack_prefix
(module_name |> Compilation_unit.Name.of_string)
in
Compilation_unit.set_current (Some compilation_unit);
Env.set_unit_name (Some compilation_unit);
let env = Compmisc.initial_env() in
let dump_file = String.concat "." [output_prefix; dump_ext] in
Compmisc.with_ppf_dump ~file_prefix:dump_file (fun ppf_dump ->
k {
target;
module_name = compilation_unit;
output_prefix;
env;
ppf_dump;
tool_name;
Expand All @@ -60,7 +59,8 @@ let typecheck_intf info ast =
let tsg =
ast
|> Typemod.type_interface
~sourcefile:info.source_file info.module_name info.env
~sourcefile:(Unit_info.source_file info.target)
info.module_name info.env
|> print_if info.ppf_dump Clflags.dump_typedtree Printtyped.interface
in
let alerts = Builtin_attributes.alerts_of_sig ~mark:true ast in
Expand All @@ -76,9 +76,18 @@ let typecheck_intf info ast =
Warnings.check_fatal ();
alerts, tsg

<<<<<<< HEAD
let emit_signature info alerts tsg =
let sg =
let name = Compilation_unit.name info.module_name in
||||||| parent of c6823d0165 (Minor Unit_info-related fixes etc)
let emit_signature info ast tsg =
let sg =
let name = Compilation_unit.name info.module_name in
=======
let emit_signature info ast tsg =
let sg : Cmi_format.cmi_infos_lazy =
>>>>>>> c6823d0165 (Minor Unit_info-related fixes etc)
let kind : Cmi_format.kind =
if !Clflags.as_parameter then
Parameter
Expand All @@ -92,9 +101,10 @@ let emit_signature info alerts tsg =
end
in
Env.save_signature ~alerts tsg.Typedtree.sig_type
(Compilation_unit.name info.module_name) kind
(Unit_info.cmi info.target)
in
Typemod.save_signature info.target tsg info.env sg
Typemod.save_signature info.target info.module_name tsg info.env sg

let interface ~hook_parse_tree ~hook_typed_tree info =
Profile.record_call (Unit_info.source_file info.target) @@ fun () ->
Expand All @@ -120,7 +130,7 @@ let parse_impl i =
let typecheck_impl i parsetree =
parsetree
|> Profile.(record typing)
(Typemod.type_implementation ~sourcefile:i.target i.env)
(Typemod.type_implementation i.target i.module_name i.env)
|> print_if i.ppf_dump Clflags.dump_typedtree
Printtyped.implementation_with_coercion
|> print_if i.ppf_dump Clflags.dump_shape
Expand Down
5 changes: 3 additions & 2 deletions tools/flambda_backend_objinfo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ let print_cmo_infos cu =
print_string "Interfaces imported:\n";
Array.iter print_intf_import cu.cu_imports;
print_string "Required globals:\n";
List.iter print_required_global cu.cu_required_globals;
List.iter print_required_global cu.cu_required_compunits;
printf "Uses unsafe features: ";
(match cu.cu_primitives with
| [] -> printf "no\n"
Expand Down Expand Up @@ -227,7 +227,8 @@ let print_general_infos print_name name crc defines iter_cmi iter_cmx =

let print_global_table table =
printf "Globals defined:\n";
Symtable.iter_global_map (fun id _ -> print_line (Ident.name id)) table
Symtable.iter_global_map (fun id _ -> print_line (Symtable.Global.name id))
table

open Cmx_format
open Cmxs_format
Expand Down

0 comments on commit 9eb2bc7

Please sign in to comment.