diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-23 00:34:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-23 00:34:09 +0000 |
commit | 86d802e03a267af79663990c39865c67e0645238 (patch) | |
tree | 58b70d4a1cb95123c38c27f78e44f0c149e056b9 /lib/Sema/CodeCompleteConsumer.cpp | |
parent | 0594438e06f58ab3798416324780ab39ca9c8f54 (diff) |
Print the results of code-completion for overloading by displaying the
signature of the function with the current parameter highlighted as a
placeholder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | lib/Sema/CodeCompleteConsumer.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index f1b475a6df..a3d4d92fc3 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -169,26 +169,10 @@ PrintingCodeCompleteConsumer::ProcessOverloadCandidates(unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates) { for (unsigned I = 0; I != NumCandidates; ++I) { - std::string ArgString; - QualType ArgType; - - if (FunctionDecl *Function = Candidates[I].getFunction()) { - if (CurrentArg < Function->getNumParams()) { - ArgString = Function->getParamDecl(CurrentArg)->getNameAsString(); - ArgType = Function->getParamDecl(CurrentArg)->getOriginalType(); - } - } else if (const FunctionProtoType *Proto - = dyn_cast<FunctionProtoType>( - Candidates[I].getFunctionType())) { - if (CurrentArg < Proto->getNumArgs()) - ArgType = Proto->getArgType(CurrentArg); - } - - if (ArgType.isNull()) - OS << "...\n"; // We have no prototype or we're matching an ellipsis. - else { - ArgType.getAsStringInternal(ArgString, SemaRef.Context.PrintingPolicy); - OS << ArgString << "\n"; + if (CodeCompletionString *CCS + = Candidates[I].CreateSignatureString(CurrentArg, SemaRef)) { + OS << CCS->getAsString() << "\n"; + delete CCS; } } |