[clangd] Report position of opening paren in singature help
Summary: Only accessible via the C++ API at the moment.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51437
llvm-svn: 341065
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index 65c415f..e355a83 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -794,7 +794,17 @@
void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
OverloadCandidate *Candidates,
- unsigned NumCandidates) override {
+ unsigned NumCandidates,
+ SourceLocation OpenParLoc) override {
+ assert(!OpenParLoc.isInvalid());
+ SourceManager &SrcMgr = S.getSourceManager();
+ OpenParLoc = SrcMgr.getFileLoc(OpenParLoc);
+ if (SrcMgr.isInMainFile(OpenParLoc))
+ SigHelp.argListStart = sourceLocToPosition(SrcMgr, OpenParLoc);
+ else
+ elog("Location oustide main file in signature help: {0}",
+ OpenParLoc.printToString(SrcMgr));
+
std::vector<ScoredSignature> ScoredSignatures;
SigHelp.signatures.reserve(NumCandidates);
ScoredSignatures.reserve(NumCandidates);