Come up with new --completion option.
authorMartin Liska <mliska@suse.cz>
Thu, 28 Jun 2018 07:11:16 +0000 (09:11 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 28 Jun 2018 07:11:16 +0000 (07:11 +0000)
commitd86c7648fb9643640d8c82be19d49927aa488768
treeb45fc0d4134e27d198b87360705d0182c44f8f25
parent98086b2ba2bd021e887788cea410410e61eaee42
Come up with new --completion option.

2018-06-28  Martin Liska  <mliska@suse.cz>

* common.opt: Introduce -completion option.
* gcc.c (driver_handle_option): Handle it.
(driver::main): Print completions if completion
        is set.
* opt-suggestions.c (option_proposer::get_completions):
        New function.
(option_proposer::suggest_completion): Likewise.
(option_proposer::find_param_completions): Likewise.
(verify_autocompletions): Likewise.
(test_completion_valid_options): Likewise.
(test_completion_valid_params): Likewise.
(in_completion_p): Likewise.
(empty_completion_p): Likewise.
(test_completion_partial_match): Likewise.
(test_completion_garbage): Likewise.
(opt_proposer_c_tests): Likewise.
* opt-suggestions.h: Declare new functions.
* opts.c (common_handle_option): Handle OPT__completion_.
* selftest-run-tests.c (selftest::run_tests): Add
        opt_proposer_c_tests.
* selftest.c (assert_str_startswith): New.
* selftest.h (assert_str_startswith): Likewise.
(opt_proposer_c_tests): New.
(ASSERT_STR_STARTSWITH): Likewise.

From-SVN: r262210
gcc/ChangeLog
gcc/common.opt
gcc/gcc.c
gcc/opt-suggestions.c
gcc/opt-suggestions.h
gcc/opts.c
gcc/selftest-run-tests.c
gcc/selftest.c
gcc/selftest.h