summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-05-24 14:49:23 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-05-24 14:49:23 +0000
commitbe0eb8f498e89aede0083a082f3f455783af5d91 (patch)
tree5bbfdbf90dc0383d203103f264e3c80edca78e85 /clang-tools-extra/clangd/CodeComplete.cpp
parent3cee95e7234464415df811c1975322c2b92a96ba (diff)
downloadbcm5719-llvm-be0eb8f498e89aede0083a082f3f455783af5d91.tar.gz
bcm5719-llvm-be0eb8f498e89aede0083a082f3f455783af5d91.zip
[clangd] Serve comments for headers decls from dynamic index only
Summary: To fix a crash in code completion that occurrs when reading doc comments from files that were updated after the preamble was computed. In that case, the files on disk could've been changed and we can't rely on finding the comment text with the same range anymore. The current workaround is to not provide comments from the headers at all and rely on the dynamic index instead. A more principled solution would be to store contents of the files read inside the preamble, but it is way harder to implement properly, given that it would definitely increase the sizes of the preamble. Together with D47272, this should fix all preamble-related crashes we're aware of. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47274 llvm-svn: 333189
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index da3d238c8ad..4adb80c8470 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -586,9 +586,11 @@ public:
const auto *CCS = Candidate.CreateSignatureString(
CurrentArg, S, *Allocator, CCTUInfo, true);
assert(CCS && "Expected the CodeCompletionString to be non-null");
+ // FIXME: for headers, we need to get a comment from the index.
SigHelp.signatures.push_back(ProcessOverloadCandidate(
Candidate, *CCS,
- getParameterDocComment(S.getASTContext(), Candidate, CurrentArg)));
+ getParameterDocComment(S.getASTContext(), Candidate, CurrentArg,
+ /*CommentsFromHeader=*/false)));
}
}
@@ -1030,7 +1032,8 @@ private:
SemaCCS = Recorder->codeCompletionString(*SR);
if (Opts.IncludeComments) {
assert(Recorder->CCSema);
- DocComment = getDocComment(Recorder->CCSema->getASTContext(), *SR);
+ DocComment = getDocComment(Recorder->CCSema->getASTContext(), *SR,
+ /*CommentsFromHeader=*/false);
}
}
return Candidate.build(FileName, Scores, Opts, SemaCCS, Includes.get(), DocComment);
OpenPOWER on IntegriCloud