[clang-tools-extra] 0019684 - [clangd] Set RetainCommentsFromSystemHeaders to true

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 00:55:13 PST 2019


Author: Ilya Biryukov
Date: 2019-11-07T09:54:20+01:00
New Revision: 0019684900491f517f3b08b4fa92740b69a8cc0f

URL: https://github.com/llvm/llvm-project/commit/0019684900491f517f3b08b4fa92740b69a8cc0f
DIFF: https://github.com/llvm/llvm-project/commit/0019684900491f517f3b08b4fa92740b69a8cc0f.diff

LOG: [clangd] Set RetainCommentsFromSystemHeaders to true

clangd should retain comments from system headers.

fixes https://github.com/clangd/clangd/issues/96

Patch by lh123!

Differential revision: https://reviews.llvm.org/D69928

Added: 
    

Modified: 
    clang-tools-extra/clangd/Compiler.cpp
    clang-tools-extra/clangd/index/IndexAction.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index e08014333190..795fd0082594 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -63,6 +63,7 @@ buildCompilerInvocation(const ParseInputs &Inputs,
   // createInvocationFromCommandLine sets DisableFree.
   CI->getFrontendOpts().DisableFree = false;
   CI->getLangOpts()->CommentOpts.ParseAllComments = true;
+  CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
   return CI;
 }
 

diff  --git a/clang-tools-extra/clangd/index/IndexAction.cpp b/clang-tools-extra/clangd/index/IndexAction.cpp
index 0814e7f09793..8fd2159932b4 100644
--- a/clang-tools-extra/clangd/index/IndexAction.cpp
+++ b/clang-tools-extra/clangd/index/IndexAction.cpp
@@ -160,6 +160,7 @@ class IndexAction : public ASTFrontendAction {
   bool BeginInvocation(CompilerInstance &CI) override {
     // We want all comments, not just the doxygen ones.
     CI.getLangOpts().CommentOpts.ParseAllComments = true;
+    CI.getLangOpts().RetainCommentsFromSystemHeaders = true;
     // Index the whole file even if there are warnings and -Werror is set.
     // Avoids some analyses too. Set in two places as we're late to the party.
     CI.getDiagnosticOpts().IgnoreWarnings = true;


        


More information about the cfe-commits mailing list