[clangd] Set RetainCommentsFromSystemHeaders to true
authorIlya Biryukov <ibiryukov@google.com>
Thu, 7 Nov 2019 08:53:07 +0000 (09:53 +0100)
committerIlya Biryukov <ibiryukov@google.com>
Thu, 7 Nov 2019 08:54:20 +0000 (09:54 +0100)
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

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

index e0801433319076726f98489cde26c30cd39525ec..795fd0082594d55716da8686a4009da509f2e002 100644 (file)
@@ -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;
 }
 
index 0814e7f0979312574d5db328fc880ed5060564dd..8fd2159932b46c2b816fa9e1c5b33fcbe674bc08 100644 (file)
@@ -160,6 +160,7 @@ public:
   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;