diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2020-01-13 09:00:19 +0100 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2020-01-20 12:20:20 +0100 |
commit | 1f946ee2faba5395a04a081fbe561e3d91aa2b3d (patch) | |
tree | a14df3e3730c0d97e18060ca1c9b6360c0a8c70e /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 122443a950521c5d99a0d0479daf57fbd1de2ac2 (diff) | |
download | llvm-1f946ee2faba5395a04a081fbe561e3d91aa2b3d.zip llvm-1f946ee2faba5395a04a081fbe561e3d91aa2b3d.tar.gz llvm-1f946ee2faba5395a04a081fbe561e3d91aa2b3d.tar.bz2 |
[clang][CodeComplete] Propogate printing policy to FunctionDecl
Summary:
Printing policy was not propogated to functiondecls when creating a
completion string which resulted in canonical template parameters like
`foo<type-parameter-0-0>`. This patch propogates printing policy to those as
well.
Fixes https://github.com/clangd/clangd/issues/76
Reviewers: ilya-biryukov
Subscribers: jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72715
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 7260977..3348067 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -37,6 +37,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Path.h" +#include "llvm/Support/raw_ostream.h" #include <list> #include <map> #include <string> @@ -3705,8 +3706,11 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( Result.addBriefComment(RC->getBriefText(S.getASTContext())); } AddResultTypeChunk(S.Context, Policy, FDecl, QualType(), Result); - Result.AddTextChunk( - Result.getAllocator().CopyString(FDecl->getNameAsString())); + + std::string Name; + llvm::raw_string_ostream OS(Name); + FDecl->getDeclName().print(OS, Policy); + Result.AddTextChunk(Result.getAllocator().CopyString(OS.str())); } else { Result.AddResultTypeChunk(Result.getAllocator().CopyString( Proto->getReturnType().getAsString(Policy))); |