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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307479
91177308-0d34-0410-b5e6-
96231b3b80d8
// to start with.
///
/// \return The vector of flags which start with Cur.
- std::vector<std::string> findByPrefix(StringRef Cur) const;
+ std::vector<std::string> findByPrefix(StringRef Cur,
+ unsigned short DisableFlags) const;
/// \brief Parse a single argument; returning the new argument and
/// updating Index.
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))