summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/Merge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/index/Merge.cpp')
-rw-r--r--clang-tools-extra/clangd/index/Merge.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang-tools-extra/clangd/index/Merge.cpp b/clang-tools-extra/clangd/index/Merge.cpp
index 76c5955893e..0c9d0c8d3b1 100644
--- a/clang-tools-extra/clangd/index/Merge.cpp
+++ b/clang-tools-extra/clangd/index/Merge.cpp
@@ -186,11 +186,17 @@ Symbol mergeSymbol(const Symbol &L, const Symbol &R) {
S.Signature = O.Signature;
if (S.CompletionSnippetSuffix == "")
S.CompletionSnippetSuffix = O.CompletionSnippetSuffix;
- // Don't accept documentation from bare forward declarations, if there is a
- // definition and it didn't provide one. S is often an undocumented class,
- // and O is a non-canonical forward decl preceded by an irrelevant comment.
- if (S.Documentation == "" && !S.Definition)
- S.Documentation = O.Documentation;
+ if (S.Documentation == "") {
+ // Don't accept documentation from bare forward class declarations, if there
+ // is a definition and it didn't provide one. S is often an undocumented
+ // class, and O is a non-canonical forward decl preceded by an irrelevant
+ // comment.
+ bool IsClass = S.SymInfo.Kind == index::SymbolKind::Class ||
+ S.SymInfo.Kind == index::SymbolKind::Struct ||
+ S.SymInfo.Kind == index::SymbolKind::Union;
+ if (!IsClass || !S.Definition)
+ S.Documentation = O.Documentation;
+ }
if (S.ReturnType == "")
S.ReturnType = O.ReturnType;
if (S.Type == "")
OpenPOWER on IntegriCloud