diff --git a/ocaml/driver/compile_common.ml b/ocaml/driver/compile_common.ml index 007b4ca21fb..66a2555a669 100644 --- a/ocaml/driver/compile_common.ml +++ b/ocaml/driver/compile_common.ml @@ -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; @@ -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 @@ -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 @@ -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 () -> @@ -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 diff --git a/tools/flambda_backend_objinfo.ml b/tools/flambda_backend_objinfo.ml index cd31a8a6215..c98bb82e111 100644 --- a/tools/flambda_backend_objinfo.ml +++ b/tools/flambda_backend_objinfo.ml @@ -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" @@ -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