MPR#7643, ocamldep: fix nested structure blowup

master
octachron 2017-09-28 12:25:49 +02:00 committed by Gabriel Scherer
parent bbfc908eb8
commit cbf40e64ac
3 changed files with 12 additions and 6 deletions

View File

@ -67,6 +67,7 @@ Stephen Dolan <stedolan>
Junsong Li <lijunsong@mantis>
Junsong Li <ljs.darkfish@gmail.com>
Christophe Raffali <craff@mantis>
Christophe Raffali <ChriChri@mantis>
Anton Bachin <antron@mantis>
Reed Wilson <omion>
David Scott <djs55>

View File

@ -395,6 +395,10 @@ Release branch for 4.06:
and module type elements
(Florian Angeletti, review by Yawar Amin and Gabriel Scherer)
- MPR#7643, GPR#1377: ocamldep, fix an exponential blowup in presence of nested
structures and signatures (e.g. "include struct … include(struct … end) … end")
(Florian Angeletti, review by Gabriel Scherer, report by Christophe Raffalli)
- GPR#681: Introduce ocamltest, a new test driver for the
OCaml compiler testsuite
(Sébastien Hinderer, review by Damien Doligez)

View File

@ -324,16 +324,16 @@ and add_module_alias bv l =
| _ -> addmodule bv l; bound (* cannot delay *)
and add_modtype_binding bv mty =
if not !Clflags.transparent_modules then add_modtype bv mty;
match mty.pmty_desc with
Pmty_alias l ->
if not !Clflags.transparent_modules then addmodule bv l;
add_module_alias bv l
| Pmty_signature s ->
make_node (add_signature_binding bv s)
| Pmty_typeof modl ->
add_module_binding bv modl
| _ ->
if !Clflags.transparent_modules then add_modtype bv mty; bound
add_modtype bv mty; bound
and add_signature bv sg =
ignore (add_signature_binding bv sg)
@ -386,9 +386,9 @@ and add_sig_item (bv, m) item =
(bv, m)
and add_module_binding bv modl =
if not !Clflags.transparent_modules then add_module bv modl;
match modl.pmod_desc with
Pmod_ident l ->
if not !Clflags.transparent_modules then addmodule bv l;
begin try
add_parent bv l;
lookup_map l.txt bv
@ -398,9 +398,10 @@ and add_module_binding bv modl =
| _ -> addmodule bv l; bound
end
| Pmod_structure s ->
make_node (snd (add_structure_binding bv s))
| _ ->
if !Clflags.transparent_modules then add_module bv modl; bound
let n = make_node (snd @@ add_structure_binding bv s) in
if not !Clflags.transparent_modules then add_names (collect_free n);
n
| _ -> add_module bv modl; bound
and add_module bv modl =
match modl.pmod_desc with