diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 22 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 24 |
2 files changed, 25 insertions, 21 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index 8af54b99393..c7d4fc4efa8 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -20,8 +20,8 @@ #include "clang/AST/DeclarationName.h" #include "clang/AST/Type.h" #include "clang/Basic/IdentifierTable.h" -#include "clang/Sema/Sema.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Sema/Sema.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -29,6 +29,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> @@ -624,16 +625,17 @@ static std::string getOverloadAsString(const CodeCompletionString &CCS) { return OS.str(); } -void -PrintingCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef, - unsigned CurrentArg, - OverloadCandidate *Candidates, - unsigned NumCandidates) { +void PrintingCodeCompleteConsumer::ProcessOverloadCandidates( + Sema &SemaRef, unsigned CurrentArg, OverloadCandidate *Candidates, + unsigned NumCandidates, SourceLocation OpenParLoc) { + OS << "OPENING_PAREN_LOC: "; + OpenParLoc.print(OS, SemaRef.getSourceManager()); + OS << "\n"; + for (unsigned I = 0; I != NumCandidates; ++I) { - if (CodeCompletionString *CCS - = Candidates[I].CreateSignatureString(CurrentArg, SemaRef, - getAllocator(), CCTUInfo, - includeBriefComments())) { + if (CodeCompletionString *CCS = Candidates[I].CreateSignatureString( + CurrentArg, SemaRef, getAllocator(), CCTUInfo, + includeBriefComments())) { OS << "OVERLOAD: " << getOverloadAsString(*CCS) << "\n"; } } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 30af826ef6c..e0adf38f93e 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -4435,10 +4435,11 @@ static QualType getParamType(Sema &SemaRef, return ParamType; } -static void CodeCompleteOverloadResults(Sema &SemaRef, Scope *S, - MutableArrayRef<ResultCandidate> Candidates, - unsigned CurrentArg, - bool CompleteExpressionWithCurrentArg = true) { +static void +CodeCompleteOverloadResults(Sema &SemaRef, Scope *S, + MutableArrayRef<ResultCandidate> Candidates, + unsigned CurrentArg, SourceLocation OpenParLoc, + bool CompleteExpressionWithCurrentArg = true) { QualType ParamType; if (CompleteExpressionWithCurrentArg) ParamType = getParamType(SemaRef, Candidates, CurrentArg); @@ -4449,12 +4450,12 @@ static void CodeCompleteOverloadResults(Sema &SemaRef, Scope *S, SemaRef.CodeCompleteExpression(S, ParamType); if (!Candidates.empty()) - SemaRef.CodeCompleter->ProcessOverloadCandidates(SemaRef, CurrentArg, - Candidates.data(), - Candidates.size()); + SemaRef.CodeCompleter->ProcessOverloadCandidates( + SemaRef, CurrentArg, Candidates.data(), Candidates.size(), OpenParLoc); } -void Sema::CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args) { +void Sema::CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args, + SourceLocation OpenParLoc) { if (!CodeCompleter) return; @@ -4552,12 +4553,13 @@ void Sema::CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args) { } mergeCandidatesWithResults(*this, Results, CandidateSet, Loc); - CodeCompleteOverloadResults(*this, S, Results, Args.size(), + CodeCompleteOverloadResults(*this, S, Results, Args.size(), OpenParLoc, !CandidateSet.empty()); } void Sema::CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc, - ArrayRef<Expr *> Args) { + ArrayRef<Expr *> Args, + SourceLocation OpenParLoc) { if (!CodeCompleter) return; @@ -4592,7 +4594,7 @@ void Sema::CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc, SmallVector<ResultCandidate, 8> Results; mergeCandidatesWithResults(*this, Results, CandidateSet, Loc); - CodeCompleteOverloadResults(*this, S, Results, Args.size()); + CodeCompleteOverloadResults(*this, S, Results, Args.size(), OpenParLoc); } void Sema::CodeCompleteInitializer(Scope *S, Decl *D) { |