1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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

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.

Reviewers: teemperor, v.g.vassilev

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D39342

llvm-svn: 326684
This commit is contained in:
Yuka Takahashi 2018-03-05 08:54:20 +00:00
parent 3e66b31c6a
commit 1a6b7a6545

View File

@ -219,7 +219,7 @@ OptTable::suggestValueCompletions(StringRef Option, StringRef Arg) const {
std::vector<std::string> Result;
for (StringRef Val : Candidates)
if (Val.startswith(Arg))
if (Val.startswith(Arg) && Arg.compare(Val))
Result.push_back(Val);
return Result;
}
@ -240,7 +240,7 @@ OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const {
std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t";
if (In.HelpText)
S += In.HelpText;
if (StringRef(S).startswith(Cur))
if (StringRef(S).startswith(Cur) && S.compare(std::string(Cur) + "\t"))
Ret.push_back(S);
}
}