diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-08 17:48:59 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-08 17:48:59 +0000 |
commit | 33cf63b7f26946e6f14878ad9400f4e77f723f0f (patch) | |
tree | 6389be627ed50ecba138b75f4f60d485a981e333 /llvm/lib/Option/OptTable.cpp | |
parent | 15309d1ce1fb1c0934a56d35fdaeaf5b5b088b34 (diff) | |
download | llvm-33cf63b7f26946e6f14878ad9400f4e77f723f0f.zip llvm-33cf63b7f26946e6f14878ad9400f4e77f723f0f.tar.gz llvm-33cf63b7f26946e6f14878ad9400f4e77f723f0f.tar.bz2 |
[Bash-autocompletion] Auto complete cc1 options if -cc1 is specified
Summary:
We don't want to autocomplete flags whose Flags class has `NoDriverOption` when argv[1] is not `-cc1`.
Another idea for this implementation is to make --autocomplete a cc1
option and handle it in clang Frontend, by porting --autocomplete
handler from Driver to Frontend, so that we can handle Driver options
and CC1 options in unified manner.
Differential Revision: https://reviews.llvm.org/D34770
llvm-svn: 307479
Diffstat (limited to 'llvm/lib/Option/OptTable.cpp')
-rw-r--r-- | llvm/lib/Option/OptTable.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index a5c12ac..bcd3652 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -225,11 +225,15 @@ OptTable::suggestValueCompletions(StringRef Option, StringRef Arg) const { return {}; } -std::vector<std::string> OptTable::findByPrefix(StringRef Cur) const { +std::vector<std::string> +OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const { std::vector<std::string> Ret; for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) { if (!In.Prefixes || (!In.HelpText && !In.GroupID)) continue; + if (In.Flags & DisableFlags) + continue; + for (int I = 0; In.Prefixes[I]; I++) { std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); if (StringRef(S).startswith(Cur)) |