summaryrefslogtreecommitdiffstats
path: root/tools/ocamldep.ml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ocamldep.ml')
-rw-r--r--tools/ocamldep.ml13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index 1bafbc678..1b958db23 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -207,9 +207,16 @@ let read_parse_and_extract parse_function extract_function magic source_file =
Depend.free_structure_names := Depend.StringSet.empty;
try
let input_file = Pparse.preprocess source_file in
- let ast = Pparse.file Format.err_formatter input_file parse_function magic in
- extract_function Depend.StringSet.empty ast;
- !Depend.free_structure_names
+ begin try
+ let ast =
+ Pparse.file Format.err_formatter input_file parse_function magic in
+ extract_function Depend.StringSet.empty ast;
+ Pparse.remove_preprocessed input_file;
+ !Depend.free_structure_names
+ with x ->
+ Pparse.remove_preprocessed_if_ast input_file;
+ raise x
+ end
with x ->
report_err source_file x;
Depend.StringSet.empty