diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-07-09 11:33:31 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-07-09 11:33:31 +0000 |
commit | 1f172eb39980e9bd68109a67590497b9c51fbae5 (patch) | |
tree | e24f9b4b16da32492c8f9731d673547fb3cb14b3 /clang-tools-extra/clangd/ClangdUnit.cpp | |
parent | 3a76f9cd440b55bd2f918b0401f3e3e2d5e83659 (diff) |
[clangd] Do not write comments into Preamble PCH
Summary:
To avoid wasting time deserializing them on code completion and
further reparses.
We do not use the comments anyway, because we cannot rely on the file
contents staying the same for reparses that reuse the prebuilt
preamble PCH.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ioeric, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D48943
Diffstat (limited to 'clang-tools-extra/clangd/ClangdUnit.cpp')
-rw-r--r-- | clang-tools-extra/clangd/ClangdUnit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp index a6ec1937a36..d91be1ee700 100644 --- a/clang-tools-extra/clangd/ClangdUnit.cpp +++ b/clang-tools-extra/clangd/ClangdUnit.cpp @@ -24,6 +24,7 @@ #include "clang/Lex/Lexer.h" #include "clang/Lex/MacroInfo.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PreprocessorOptions.h" #include "clang/Sema/Sema.h" #include "clang/Serialization/ASTWriter.h" #include "clang/Tooling/CompilationDatabase.h" @@ -323,6 +324,9 @@ std::shared_ptr<const PreambleData> clangd::buildPreamble( // the preamble and make it smaller. assert(!CI.getFrontendOpts().SkipFunctionBodies); CI.getFrontendOpts().SkipFunctionBodies = true; + // We don't want to write comment locations into PCH. They are racy and slow + // to read back. We rely on dynamic index for the comments instead. + CI.getPreprocessorOpts().WriteCommentListToPCH = false; CppFilePreambleCallbacks SerializedDeclsCollector(FileName, PreambleCallback); if (Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory)) { |