[llvm] r309113 - [Bash-autocompletion] Show HelpText with possible flags

Yuka Takahashi via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 06:36:58 PDT 2017


Author: yamaguchi
Date: Wed Jul 26 06:36:58 2017
New Revision: 309113

URL: http://llvm.org/viewvc/llvm-project?rev=309113&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Option/OptTable.cpp

Modified: llvm/trunk/lib/Option/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/OptTable.cpp?rev=309113&r1=309112&r2=309113&view=diff
==============================================================================
--- llvm/trunk/lib/Option/OptTable.cpp (original)
+++ llvm/trunk/lib/Option/OptTable.cpp Wed Jul 26 06:36:58 2017
@@ -235,7 +235,9 @@ OptTable::findByPrefix(StringRef Cur, un
       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);
     }




More information about the llvm-commits mailing list