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.

And improve comment handling in textDocument/hover

Fix #373
This commit is contained in:
Fangrui Song 2019-04-11 22:26:07 -07:00
parent 3a364c868b
commit 0951004370

View File

@ -48,8 +48,11 @@ GetHover(DB *db, LanguageId lang, SymbolRef sym, int file_id) {
std::optional<MarkedString> ls_comments, hover;
WithEntity(db, sym, [&](const auto &entity) {
for (auto &d : entity.def) {
if (!comments && d.comments[0])
comments = d.comments;
if (d.spell) {
comments = d.comments[0] ? d.comments : nullptr;
if (d.comments[0])
comments = d.comments;
if (const char *s =
d.hover[0] ? d.hover
: d.detailed_name[0] ? d.detailed_name : nullptr) {
@ -64,8 +67,6 @@ GetHover(DB *db, LanguageId lang, SymbolRef sym, int file_id) {
}
if (!hover && entity.def.size()) {
auto &d = entity.def[0];
if (d.comments[0])
comments = d.comments;
hover = {LanguageIdentifier(lang)};
if (d.hover[0])
hover->value = d.hover;