diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:32:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:32:52 +0000 |
commit | 08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch) | |
tree | 80108f0f128657f8623f8f66ad9735b4d88e7b47 /include/llvm/Option | |
parent | 7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff) |
Diffstat (limited to 'include/llvm/Option')
-rw-r--r-- | include/llvm/Option/OptParser.td | 2 | ||||
-rw-r--r-- | include/llvm/Option/OptTable.h | 14 | ||||
-rw-r--r-- | include/llvm/Option/Option.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/Option/OptParser.td b/include/llvm/Option/OptParser.td index 4da86f09750d..481223698719 100644 --- a/include/llvm/Option/OptParser.td +++ b/include/llvm/Option/OptParser.td @@ -92,6 +92,7 @@ class Option<list<string> prefixes, string name, OptionKind kind> { int NumArgs = 0; string HelpText = ?; string MetaVarName = ?; + string Values = ?; list<OptionFlag> Flags = []; OptionGroup Group = ?; Option Alias = ?; @@ -126,6 +127,7 @@ class Flags<list<OptionFlag> flags> { list<OptionFlag> Flags = flags; } class Group<OptionGroup group> { OptionGroup Group = group; } class HelpText<string text> { string HelpText = text; } class MetaVarName<string name> { string MetaVarName = name; } +class Values<string value> { string Values = value; } // Predefined options. diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index e0169b927319..3e7b019a0d4e 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -53,6 +53,7 @@ public: unsigned short GroupID; unsigned short AliasID; const char *AliasArgs; + const char *Values; }; private: @@ -120,6 +121,19 @@ public: return getInfo(id).MetaVar; } + /// Find possible value for given flags. This is used for shell + /// autocompletion. + /// + /// \param [in] Option - Key flag like "-stdlib=" when "-stdlib=l" + /// was passed to clang. + /// + /// \param [in] Arg - Value which we want to autocomplete like "l" + /// when "-stdlib=l" was passed to clang. + /// + /// \return The vector of possible values. + std::vector<std::string> suggestValueCompletions(StringRef Option, + StringRef Arg) const; + /// Find flags from OptTable which starts with Cur. /// /// \param [in] Cur - String prefix that all returned flags need diff --git a/include/llvm/Option/Option.h b/include/llvm/Option/Option.h index c08834f90598..d9aebd5b0757 100644 --- a/include/llvm/Option/Option.h +++ b/include/llvm/Option/Option.h @@ -57,6 +57,7 @@ public: UnknownClass, FlagClass, JoinedClass, + ValuesClass, SeparateClass, RemainingArgsClass, RemainingArgsJoinedClass, @@ -155,6 +156,7 @@ public: case CommaJoinedClass: return RenderCommaJoinedStyle; case FlagClass: + case ValuesClass: case SeparateClass: case MultiArgClass: case JoinedOrSeparateClass: |