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 | f0f51985a1a8d2ce2dd632819db24e367f980689 (patch) | |
tree | 1e9e5d3c5aa01adc9684554256d56de8420de575 /clang/lib/Sema/CodeCompleteConsumer.cpp | |
parent | 05f477c1779edd30cc472824b8e2924fcdc9e122 (diff) | |
download | bcm5719-llvm-f0f51985a1a8d2ce2dd632819db24e367f980689.tar.gz bcm5719-llvm-f0f51985a1a8d2ce2dd632819db24e367f980689.zip |
Print the results of code-completion for overloading by displaying the
signature of the function with the current parameter highlighted as a
placeholder.
llvm-svn: 82593
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index f1b475a6df5..a3d4d92fc3c 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/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; } } |