diff options
| author | Graydon Hoare <[email protected]> | 2010-07-20 13:55:56 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-07-20 13:55:56 -0700 |
| commit | 62522def7409a233f5316546cd6bee91e812a039 (patch) | |
| tree | 5ac4085ee755b9c83bdd378d6460d4a57ebb0846 /src/boot/driver | |
| parent | Re-XFAIL stuff that is definitely still unsupported in LLVM-land (like, throw... (diff) | |
| download | rust-62522def7409a233f5316546cd6bee91e812a039.tar.xz rust-62522def7409a233f5316546cd6bee91e812a039.zip | |
Tidy up handling of unimplemented features. These are expected (if undesirable) sorts of error, we should handle better than "backtrace and exit 2".
Diffstat (limited to 'src/boot/driver')
| -rw-r--r-- | src/boot/driver/main.ml | 24 | ||||
| -rw-r--r-- | src/boot/driver/session.ml | 13 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/boot/driver/main.ml b/src/boot/driver/main.ml index 9cb068ef..cef66f77 100644 --- a/src/boot/driver/main.ml +++ b/src/boot/driver/main.ml @@ -238,7 +238,7 @@ let _ = ;; -let (crate:Ast.crate) = +let parse_input_crate _ : Ast.crate = Session.time_inner "parse" sess begin fun _ -> @@ -292,6 +292,15 @@ let (crate:Ast.crate) = end ;; +let (crate:Ast.crate) = + try + parse_input_crate() + with + Not_implemented (ido, str) -> + Session.report_err sess ido str; + { node = Ast.empty_crate'; id = Common.Node 0 } +;; + exit_if_failed () ;; @@ -399,9 +408,16 @@ let main_pipeline _ = exit_if_failed () ;; -if sess.Session.sess_alt_backend -then Glue.alt_pipeline sess sem_cx crate -else main_pipeline () +try + if sess.Session.sess_alt_backend + then Glue.alt_pipeline sess sem_cx crate + else main_pipeline () +with + Not_implemented (ido, str) -> + Session.report_err sess ido str +;; + +exit_if_failed () ;; if sess.Session.sess_report_timing diff --git a/src/boot/driver/session.ml b/src/boot/driver/session.ml index 80253f44..210dd7be 100644 --- a/src/boot/driver/session.ml +++ b/src/boot/driver/session.ml @@ -101,6 +101,19 @@ let filename_of (fo:filename option) : filename = | Some f -> f ;; +let report_err sess ido str = + let spano = match ido with + None -> None + | Some id -> get_span sess id + in + match spano with + None -> + fail sess "Error: %s\n%!" str + | Some span -> + fail sess "%s:E:Error: %s\n%!" + (string_of_span span) str +;; + (* * Local Variables: * fill-column: 78; |