This is an archive of the discontinued LLVM Phabricator instance.

[Bash-autocompletion] Pass all flags in shell command-line to Clang
ClosedPublic

Authored by yamaguchi on Oct 26 2017, 1:23 PM.

Details

Summary

Previously, we passed "#" to --autocomplete to indicate to enable cc1
flags. For example, when -cc1 or -Xclang was passed to bash, bash
executed clang --autocomplete=#-<flag they want to complete>.

However, this was not a good implementation because it depends -Xclang
and -cc1 parsing to shell. So I changed this to pass all flags shell
has, so that Clang can handle them internally.

I had to change many testcases because API spec changed quite a lot.

Diff Detail

Repository
rL LLVM

Event Timeline

yamaguchi created this revision.Oct 26 2017, 1:23 PM
v.g.vassilev added inline comments.Oct 27 2017, 12:30 PM
clang/lib/Driver/Driver.cpp
1171 ↗(On Diff #120474)

Why not a while loop?

yamaguchi added inline comments.Oct 27 2017, 4:57 PM
clang/lib/Driver/Driver.cpp
1171 ↗(On Diff #120474)

I didn't have special reason, I'll change it to while if it fits better.

yamaguchi updated this revision to Diff 121444.Nov 3 2017, 2:37 AM

Update diff. Pass all flags just with "," including values.

yamaguchi edited the summary of this revision. (Show Details)Nov 3 2017, 3:06 AM
yamaguchi updated this revision to Diff 121449.Nov 3 2017, 3:08 AM

Made a trivial fix in the testcase

teemperor accepted this revision.Mar 3 2018, 2:01 AM

As this will land in clang 7, can you add a note to the release notes that this breaks backwards compatibility for this interface (can be another commit)? Also, we should point out that this is the only API change this interface will have in the foreseeable future.

This revision is now accepted and ready to land.Mar 3 2018, 2:01 AM
This revision was automatically updated to reflect the committed changes.