diff options
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 5369a4beb21..28f85d7a9f1 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -3825,22 +3825,6 @@ void Sema::CodeCompleteCase(Scope *S) { Results.data(),Results.size()); } -namespace { - struct IsBetterOverloadCandidate { - Sema &S; - SourceLocation Loc; - - public: - explicit IsBetterOverloadCandidate(Sema &S, SourceLocation Loc) - : S(S), Loc(Loc) { } - - bool - operator()(const OverloadCandidate &X, const OverloadCandidate &Y) const { - return isBetterOverloadCandidate(S, X, Y, Loc); - } - }; -} - static bool anyNullArguments(ArrayRef<Expr *> Args) { if (Args.size() && !Args.data()) return true; @@ -3902,9 +3886,12 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) { if (!CandidateSet.empty()) { // Sort the overload candidate set by placing the best overloads first. - std::stable_sort(CandidateSet.begin(), CandidateSet.end(), - IsBetterOverloadCandidate(*this, Loc)); - + std::stable_sort( + CandidateSet.begin(), CandidateSet.end(), + [&](const OverloadCandidate &X, const OverloadCandidate &Y) { + return isBetterOverloadCandidate(*this, X, Y, Loc); + }); + // Add the remaining viable overload candidates as code-completion reslults. for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), CandEnd = CandidateSet.end(); |