Set RetainCommentsFromSystemHeaders to true

Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

Fix #373
This commit is contained in:
Fangrui Song 2019-04-11 22:26:07 -07:00
parent 64f9dbdc7a
commit 6710dbc2e9
2 changed files with 3 additions and 2 deletions

View File

@ -1238,8 +1238,8 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
ok = false;
// -fparse-all-comments enables documentation in the indexer and in
// code completion.
if (g_config->index.comments > 1)
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
CI->getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1;
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
std::string buf = wfiles->GetContent(main);
std::vector<std::unique_ptr<llvm::MemoryBuffer>> Bufs;
if (buf.size())

View File

@ -363,6 +363,7 @@ void BuildPreamble(Session &session, CompilerInvocation &CI,
CI.getDiagnosticOpts().IgnoreWarnings = false;
CI.getFrontendOpts().SkipFunctionBodies = true;
CI.getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1;
CI.getLangOpts()->RetainCommentsFromSystemHeaders = true;
StoreDiags DC(task.path);
IntrusiveRefCntPtr<DiagnosticsEngine> DE =