From: Hans Wennborg Date: Fri, 28 Jul 2017 21:29:27 +0000 (+0000) Subject: Merging r309113: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f268da9127f76c6f737889e0d24c6dd90fbdaa25;p=llvm Merging r309113: ------------------------------------------------------------------------ r309113 | yamaguchi | 2017-07-26 06:36:58 -0700 (Wed, 26 Jul 2017) | 19 lines [Bash-autocompletion] Show HelpText with possible flags Summary: `clang --autocomplete=-std` will show ``` -std: Language standard to compile for -std= Language standard to compile for -stdlib= C++ standard library to use ``` after this change. However, showing HelpText with completion in bash seems super tricky, so this feature will be used in other shells (fish, zsh...). Reviewers: v.g.vassilev, teemperor, ruiu Subscribers: cfe-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35759 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@309437 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp index f3b438e829d..51c62d33f8e 100644 --- a/lib/Option/OptTable.cpp +++ b/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const { continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) + S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); }