diff options
author | Maria Christakis <[email protected]> | 2010-10-17 18:20:53 +0300 |
---|---|---|
committer | Maria Christakis <[email protected]> | 2010-11-30 10:11:37 +0200 |
commit | f1d81c87d832c805a90a8dceca247cecaad803ab (patch) | |
tree | a60013d9f913af3a4ba445725694ef429d6c9cc5 /lib/dialyzer/src/dialyzer.erl | |
parent | 4101091756a98d78cde0d6b2d88959dae324e860 (diff) | |
download | otp-f1d81c87d832c805a90a8dceca247cecaad803ab.tar.gz otp-f1d81c87d832c805a90a8dceca247cecaad803ab.tar.bz2 otp-f1d81c87d832c805a90a8dceca247cecaad803ab.zip |
dialyzer: Add support for multiple PLTs
This new feature is able to take multiple PLTs, merge them during the
start of the analysis, and work from there. This works provided that
the PLTs do not have a module with the same name appearing in more
than one PLT.
The PLTs are created in the usual way:
dialyzer --build_plt --output_plt PLT_1 FILES_TO_INCLUDE
...
dialyzer --build_plt --output_plt PLT_N FILES_TO_INCLUDE
and then can be used in either of the following ways:
dialyzer FILES_TO_ANALYZE --plts PLT_1 ... PLT_N
or:
dialyzer --plts PLT_1 ... PLT_N -- FILES_TO_ANALYZE
(Note the -- delimiter in the second case)
Diffstat (limited to 'lib/dialyzer/src/dialyzer.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer.erl | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index b4161ea194..471f9fccd2 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -106,27 +106,35 @@ cl_print_plt_info(Opts) -> end, doit(F). -print_plt_info(#options{init_plt = PLT, output_file = OutputFile}) -> +print_plt_info(#options{init_plts = PLTs, output_file = OutputFile}) -> + PLTInfo = get_plt_info(PLTs), + do_print_plt_info(PLTInfo, OutputFile). + +get_plt_info([PLT|PLTs]) -> String = case dialyzer_plt:included_files(PLT) of {ok, Files} -> - io_lib:format("The PLT ~s includes the following files:\n~p\n", + io_lib:format("The PLT ~s includes the following files:\n~p\n\n", [PLT, Files]); {error, read_error} -> - Msg = io_lib:format("Could not read the PLT file ~p\n", [PLT]), + Msg = io_lib:format("Could not read the PLT file ~p\n\n", [PLT]), throw({dialyzer_error, Msg}); {error, no_such_file} -> - Msg = io_lib:format("The PLT file ~p does not exist\n", [PLT]), + Msg = io_lib:format("The PLT file ~p does not exist\n\n", [PLT]), throw({dialyzer_error, Msg}) end, + String ++ get_plt_info(PLTs); +get_plt_info([]) -> "". + +do_print_plt_info(PLTInfo, OutputFile) -> case OutputFile =:= none of true -> - io:format("~s", [String]), + io:format("~s", [PLTInfo]), ?RET_NOTHING_SUSPICIOUS; false -> case file:open(OutputFile, [write]) of {ok, FileDesc} -> - io:format(FileDesc, "~s", [String]), + io:format(FileDesc, "~s", [PLTInfo]), ok = file:close(FileDesc), ?RET_NOTHING_SUSPICIOUS; {error, Reason} -> |