diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp index dcd1cc46d96..5956764827e 100644 --- a/lib/Option/OptTable.cpp +++ b/lib/Option/OptTable.cpp @@ -219,7 +219,7 @@ OptTable::suggestValueCompletions(StringRef Option, StringRef Arg) const { std::vector Result; for (StringRef Val : Candidates) - if (Val.startswith(Arg)) + if (Val.startswith(Arg) && Arg.compare(Val)) Result.push_back(Val); return Result; } @@ -240,7 +240,7 @@ OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const { std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; if (In.HelpText) S += In.HelpText; - if (StringRef(S).startswith(Cur)) + if (StringRef(S).startswith(Cur) && S.compare(std::string(Cur) + "\t")) Ret.push_back(S); } }