diff options
author | John McCall <rjmccall@apple.com> | 2010-02-08 23:07:23 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-08 23:07:23 +0000 |
commit | bc077cf5897af9109ffc8fd778d2ee9d9759ef21 (patch) | |
tree | 8fa374a294a0fe49bc86a2287e33f43db1de7b84 /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | d9d7186dc0205a459a38bd24610305031376933e (diff) | |
download | bcm5719-llvm-bc077cf5897af9109ffc8fd778d2ee9d9759ef21.tar.gz bcm5719-llvm-bc077cf5897af9109ffc8fd778d2ee9d9759ef21.zip |
Thread a source location into the template-argument deduction routines. There
may be some other places that could take advantage of this new information,
but I haven't really looked yet.
llvm-svn: 95600
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 7219e316491..a8629497186 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -2196,13 +2196,15 @@ void Sema::CodeCompleteCase(Scope *S) { namespace { struct IsBetterOverloadCandidate { Sema &S; + SourceLocation Loc; public: - explicit IsBetterOverloadCandidate(Sema &S) : S(S) { } + explicit IsBetterOverloadCandidate(Sema &S, SourceLocation Loc) + : S(S), Loc(Loc) { } bool operator()(const OverloadCandidate &X, const OverloadCandidate &Y) const { - return S.isBetterOverloadCandidate(X, Y); + return S.isBetterOverloadCandidate(X, Y, Loc); } }; } @@ -2228,7 +2230,8 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, } // Build an overload candidate set based on the functions we find. - OverloadCandidateSet CandidateSet; + SourceLocation Loc = Fn->getExprLoc(); + OverloadCandidateSet CandidateSet(Loc); // FIXME: What if we're calling something that isn't a function declaration? // FIXME: What if we're calling a pseudo-destructor? @@ -2256,7 +2259,7 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, if (!CandidateSet.empty()) { // Sort the overload candidate set by placing the best overloads first. std::stable_sort(CandidateSet.begin(), CandidateSet.end(), - IsBetterOverloadCandidate(*this)); + IsBetterOverloadCandidate(*this, Loc)); // Add the remaining viable overload candidates as code-completion reslults. for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), |