Skip to content

Commit 4168c1d

Browse files
committed
Add -lpasses for logging just the progress of passes.
1 parent cdf67b1 commit 4168c1d

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/boot/driver/main.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ let (sess:Session.sess) =
3232
Session.sess_log_lex = false;
3333
Session.sess_log_parse = false;
3434
Session.sess_log_ast = false;
35+
Session.sess_log_passes = false;
3536
Session.sess_log_resolve = false;
3637
Session.sess_log_type = false;
3738
Session.sess_log_simplify = false;
@@ -162,6 +163,8 @@ let argspecs =
162163
"-lparse" "log parsing");
163164
(flag (fun _ -> sess.Session.sess_log_ast <- true)
164165
"-last" "log AST");
166+
(flag (fun _ -> sess.Session.sess_log_passes <- true)
167+
"-lpasses" "log passes at high-level");
165168
(flag (fun _ -> sess.Session.sess_log_resolve <- true)
166169
"-lresolve" "log resolution");
167170
(flag (fun _ -> sess.Session.sess_log_type <- true)

src/boot/driver/session.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type sess =
1818
mutable sess_log_lex: bool;
1919
mutable sess_log_parse: bool;
2020
mutable sess_log_ast: bool;
21+
mutable sess_log_passes: bool;
2122
mutable sess_log_resolve: bool;
2223
mutable sess_log_type: bool;
2324
mutable sess_log_simplify: bool;

src/boot/me/semant.ml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,24 +1719,44 @@ let mod_item_logging_visitor
17191719
: Walk.
17201720
visitor =
17211721
let entering _ =
1722+
if cx.ctxt_sess.Session.sess_log_passes
1723+
then
1724+
Session.log "pass" true cx.ctxt_sess.Session.sess_log_out
1725+
"pass %d: entering %a"
1726+
pass Ast.sprintf_name (path_to_name path);
17221727
if log_flag
17231728
then
17241729
log cx "pass %d: entering %a"
17251730
pass Ast.sprintf_name (path_to_name path)
17261731
in
17271732
let entered _ =
1733+
if cx.ctxt_sess.Session.sess_log_passes
1734+
then
1735+
Session.log "pass" true cx.ctxt_sess.Session.sess_log_out
1736+
"pass %d: entered %a"
1737+
pass Ast.sprintf_name (path_to_name path);
17281738
if log_flag
17291739
then
17301740
log cx "pass %d: entered %a"
17311741
pass Ast.sprintf_name (path_to_name path)
17321742
in
17331743
let leaving _ =
1744+
if cx.ctxt_sess.Session.sess_log_passes
1745+
then
1746+
Session.log "pass" true cx.ctxt_sess.Session.sess_log_out
1747+
"pass %d: leaving %a"
1748+
pass Ast.sprintf_name (path_to_name path);
17341749
if log_flag
17351750
then
17361751
log cx "pass %d: leaving %a"
17371752
pass Ast.sprintf_name (path_to_name path)
17381753
in
17391754
let left _ =
1755+
if cx.ctxt_sess.Session.sess_log_passes
1756+
then
1757+
Session.log "pass" true cx.ctxt_sess.Session.sess_log_out
1758+
"pass %d: left %a"
1759+
pass Ast.sprintf_name (path_to_name path);
17401760
if log_flag
17411761
then
17421762
log cx "pass %d: left %a"
@@ -2031,7 +2051,10 @@ let run_passes
20312051
(crate:Ast.crate)
20322052
: unit =
20332053
let do_pass i pass =
2034-
Walk.walk_crate
2054+
if cx.ctxt_sess.Session.sess_log_passes
2055+
then Session.log "pass" true cx.ctxt_sess.Session.sess_log_out
2056+
"starting pass %s # %d" name i;
2057+
Walk.walk_crate
20352058
(Walk.path_managing_visitor path
20362059
(mod_item_logging_visitor cx log_flag log i path pass))
20372060
crate

0 commit comments

Comments
 (0)