Come up with new --completion option.
commit6e8a18d1ed980e23b5e7fed4d810f294643cbd9f
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Jun 2018 07:11:16 +0000 (28 07:11 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Jun 2018 07:11:16 +0000 (28 07:11 +0000)
treeb45fc0d4134e27d198b87360705d0182c44f8f25
parent2abdff3809a5890b925cc6f742fb7adf8b48dde3
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262210 138bc75d-0d04-0410-961f-82ee72b054a4
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